From 09cdd813c5338fe1c809ee451d1aae35c14f05a8 Mon Sep 17 00:00:00 2001 From: "Coren[m]" Date: Sat, 14 Sep 2013 12:55:56 +0200 Subject: 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 --- toxcore/Messenger.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'toxcore/Messenger.c') 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) } #ifdef LOGGING +#define DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS 60 static time_t lastdump = 0; static char IDString[CLIENT_ID_SIZE * 2 + 1]; static char *ID2String(uint8_t *client_id) @@ -1245,7 +1246,7 @@ void doMessenger(Messenger *m) LANdiscovery(m); #ifdef LOGGING - if (now() > lastdump + 60) { + if (now() > lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { loglog(" = = = = = = = = \n"); lastdump = now(); @@ -1292,8 +1293,9 @@ void doMessenger(Messenger *m) ping_lastrecv = lastdump - msgfptr->ping_lastrecv; if (ping_lastrecv > 999) ping_lastrecv = 999; - snprintf(logbuffer, sizeof(logbuffer), "F[%2u] <%s> %02u [%03u] %s\n", friend, msgfptr->name, - msgfptr->crypt_connection_id, ping_lastrecv, msgfptr->client_id); + snprintf(logbuffer, sizeof(logbuffer), "F[%2u] <%s> %02u [%03u] %s\n", + friend, msgfptr->name, msgfptr->crypt_connection_id, + ping_lastrecv, ID2String(msgfptr->client_id)); loglog(logbuffer); for(client = 0; client < MAX_FRIEND_CLIENTS; client++) { @@ -1304,7 +1306,7 @@ void doMessenger(Messenger *m) snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", friend, client, ip_ntoa(&cptr->ip_port.ip), ntohs(cptr->ip_port.port), last_pinged, - cptr->client_id); + ID2String(cptr->client_id)); loglog(logbuffer); } } -- cgit v1.2.3