diff options
author | Coren[m] <Break@Ocean> | 2013-09-14 12:55:56 +0200 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-09-14 12:55:56 +0200 |
commit | 09cdd813c5338fe1c809ee451d1aae35c14f05a8 (patch) | |
tree | b41143d1e065e5ad4c26180af6a03cfdce79754b /toxcore/Messenger.c | |
parent | fa576e464e791199b4e9097bc835960f2dba5ea2 (diff) |
DHT.c:
- get_close_nodes()/sendnodes()/sendnodes_ipv6(): when selecting for SEND_NODES/SEND_NODES_IPV6, treat embedded IPv4-in-IPv6 addresses as being IPv4
Messenger.c:
- added a named constant for sixty seconds friend/client dump
- fix logging to convert client_id to printable before printing
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 8d0b149f..55b27353 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1220,6 +1220,7 @@ void doInbound(Messenger *m) | |||
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | #ifdef LOGGING | 1222 | #ifdef LOGGING |
1223 | #define DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS 60 | ||
1223 | static time_t lastdump = 0; | 1224 | static time_t lastdump = 0; |
1224 | static char IDString[CLIENT_ID_SIZE * 2 + 1]; | 1225 | static char IDString[CLIENT_ID_SIZE * 2 + 1]; |
1225 | static char *ID2String(uint8_t *client_id) | 1226 | static char *ID2String(uint8_t *client_id) |
@@ -1245,7 +1246,7 @@ void doMessenger(Messenger *m) | |||
1245 | LANdiscovery(m); | 1246 | LANdiscovery(m); |
1246 | 1247 | ||
1247 | #ifdef LOGGING | 1248 | #ifdef LOGGING |
1248 | if (now() > lastdump + 60) { | 1249 | if (now() > lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { |
1249 | loglog(" = = = = = = = = \n"); | 1250 | loglog(" = = = = = = = = \n"); |
1250 | 1251 | ||
1251 | lastdump = now(); | 1252 | lastdump = now(); |
@@ -1292,8 +1293,9 @@ void doMessenger(Messenger *m) | |||
1292 | ping_lastrecv = lastdump - msgfptr->ping_lastrecv; | 1293 | ping_lastrecv = lastdump - msgfptr->ping_lastrecv; |
1293 | if (ping_lastrecv > 999) | 1294 | if (ping_lastrecv > 999) |
1294 | ping_lastrecv = 999; | 1295 | ping_lastrecv = 999; |
1295 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] <%s> %02u [%03u] %s\n", friend, msgfptr->name, | 1296 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] <%s> %02u [%03u] %s\n", |
1296 | msgfptr->crypt_connection_id, ping_lastrecv, msgfptr->client_id); | 1297 | friend, msgfptr->name, msgfptr->crypt_connection_id, |
1298 | ping_lastrecv, ID2String(msgfptr->client_id)); | ||
1297 | loglog(logbuffer); | 1299 | loglog(logbuffer); |
1298 | 1300 | ||
1299 | for(client = 0; client < MAX_FRIEND_CLIENTS; client++) { | 1301 | for(client = 0; client < MAX_FRIEND_CLIENTS; client++) { |
@@ -1304,7 +1306,7 @@ void doMessenger(Messenger *m) | |||
1304 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", | 1306 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", |
1305 | friend, client, ip_ntoa(&cptr->ip_port.ip), | 1307 | friend, client, ip_ntoa(&cptr->ip_port.ip), |
1306 | ntohs(cptr->ip_port.port), last_pinged, | 1308 | ntohs(cptr->ip_port.port), last_pinged, |
1307 | cptr->client_id); | 1309 | ID2String(cptr->client_id)); |
1308 | loglog(logbuffer); | 1310 | loglog(logbuffer); |
1309 | } | 1311 | } |
1310 | } | 1312 | } |