int create_clock_source_record(char *sender_string,
clock_source_private_data *clocks_private_info) {
- // sometimes, the mutex will already be locked
- // return the index of a clock entry in the clock information arrays or -1 if full
+ // return the index of a clock entry in the clock information arrays or -1 if full
// initialise the entries in the shared and private arrays
int response = -1;
int i = 0;
- int found = 0;
+ int found = 0; // trying to find an unused entry
while ((found == 0) && (i < MAX_CLOCKS)) {
if (clocks_private_info[i].in_use == 0)
found = 1;
debug(2, "create record for ip: %s, family: %s.", &clocks_private_info[i].ip,
clocks_private_info[i].family == AF_INET6 ? "IPv6" : "IPv4");
} else {
- die("cannot getaddrinfo for ip: %s.", &clocks_private_info[i].ip);
+ debug(1, "cannot getaddrinfo for ip: %s.", &clocks_private_info[i].ip);
}
} else {
- die("Clock tables full!");
+ debug(1, "Clock tables full!");
}
return response;
}
int t = find_clock_source_record(new_ip, clock_private_info);
if (t == -1)
t = create_clock_source_record(new_ip, clock_private_info);
- clock_private_info[t].flags |= (1 << clock_is_a_timing_peer);
+ if (t != -1) // if the clock table is not full, show it's a timing peer
+ clock_private_info[t].flags |= (1 << clock_is_a_timing_peer);
+ // otherwise, drop it
}
}
#define NQPTP_SHM_STRUCTURES_H
#define STORAGE_ID "/nqptp"
-#define MAX_CLOCKS 32
+#define MAX_CLOCKS 64
#define NQPTP_SHM_STRUCTURES_VERSION 6
#define NQPTP_CONTROL_PORT 9000
debug_init(debug_level, 0, 1, 1);
debug(1, "startup. self clock id: \"%" PRIx64 "\".", get_self_clock_id());
+ debug(1, "size of a clock entry is %u bytes.", sizeof(clock_source_private_data));
atexit(goodbye);
sockets_open_stuff.sockets_open = 0;
recv_len); // unusual messages will have debug level 1.
break;
}
- }
+ } // otherwise, just forget it
}
}
}