diff options
author | irungentoo <irungentoo@gmail.com> | 2014-05-25 12:27:48 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-05-25 12:27:48 -0400 |
commit | 82e38883a239f265089982bc255de0f9db618ce7 (patch) | |
tree | 1d38b2ff978e86246695cc7e473af309eacdba2a /toxcore/Messenger.c | |
parent | 9d53bc5d1dabd3142f58cafd9fffa18f783f96df (diff) | |
parent | 08ca08dcd952d55a0df75e5efa25a5d8afa70e3f (diff) |
Merge branch 'mannol1-Multicalls' into multi-av
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 3fa3315d..bec3a250 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "config.h" | 25 | #include "config.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "logger.h" | ||
28 | #include "Messenger.h" | 29 | #include "Messenger.h" |
29 | #include "assoc.h" | 30 | #include "assoc.h" |
30 | #include "network.h" | 31 | #include "network.h" |
@@ -2054,6 +2055,7 @@ static int handle_packet(void *object, int i, uint8_t *temp, uint16_t len) | |||
2054 | if (m->friend_action) | 2055 | if (m->friend_action) |
2055 | (*m->friend_action)(m, i, action_terminated, action_length, m->friend_action_userdata); | 2056 | (*m->friend_action)(m, i, action_terminated, action_length, m->friend_action_userdata); |
2056 | 2057 | ||
2058 | |||
2057 | break; | 2059 | break; |
2058 | } | 2060 | } |
2059 | 2061 | ||
@@ -2339,7 +2341,7 @@ void do_messenger(Messenger *m) | |||
2339 | #ifdef LOGGING | 2341 | #ifdef LOGGING |
2340 | 2342 | ||
2341 | if (unix_time() > lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { | 2343 | if (unix_time() > lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { |
2342 | loglog(" = = = = = = = = \n"); | 2344 | |
2343 | #ifdef ENABLE_ASSOC_DHT | 2345 | #ifdef ENABLE_ASSOC_DHT |
2344 | Assoc_status(m->dht->assoc); | 2346 | Assoc_status(m->dht->assoc); |
2345 | #endif | 2347 | #endif |
@@ -2348,12 +2350,10 @@ void do_messenger(Messenger *m) | |||
2348 | size_t c; | 2350 | size_t c; |
2349 | 2351 | ||
2350 | for (c = 0; c < m->numchats; c++) { | 2352 | for (c = 0; c < m->numchats; c++) { |
2351 | loglog("---------------- \n"); | ||
2352 | Assoc_status(m->chats[c]->assoc); | 2353 | Assoc_status(m->chats[c]->assoc); |
2353 | } | 2354 | } |
2354 | } | 2355 | } |
2355 | 2356 | ||
2356 | loglog(" = = = = = = = = \n"); | ||
2357 | 2357 | ||
2358 | lastdump = unix_time(); | 2358 | lastdump = unix_time(); |
2359 | uint32_t client, last_pinged; | 2359 | uint32_t client, last_pinged; |
@@ -2370,14 +2370,12 @@ void do_messenger(Messenger *m) | |||
2370 | if (last_pinged > 999) | 2370 | if (last_pinged > 999) |
2371 | last_pinged = 999; | 2371 | last_pinged = 999; |
2372 | 2372 | ||
2373 | snprintf(logbuffer, sizeof(logbuffer), "C[%2u] %s:%u [%3u] %s\n", | 2373 | LOGGER_INFO("C[%2u] %s:%u [%3u] %s", |
2374 | client, ip_ntoa(&assoc->ip_port.ip), ntohs(assoc->ip_port.port), | 2374 | client, ip_ntoa(&assoc->ip_port.ip), ntohs(assoc->ip_port.port), |
2375 | last_pinged, ID2String(cptr->client_id)); | 2375 | last_pinged, ID2String(cptr->client_id)); |
2376 | loglog(logbuffer); | ||
2377 | } | 2376 | } |
2378 | } | 2377 | } |
2379 | 2378 | ||
2380 | loglog(" = = = = = = = = \n"); | ||
2381 | 2379 | ||
2382 | uint32_t friend, dhtfriend; | 2380 | uint32_t friend, dhtfriend; |
2383 | 2381 | ||
@@ -2405,9 +2403,7 @@ void do_messenger(Messenger *m) | |||
2405 | dht2m[m2dht[friend]] = friend; | 2403 | dht2m[m2dht[friend]] = friend; |
2406 | 2404 | ||
2407 | if (m->numfriends != m->dht->num_friends) { | 2405 | if (m->numfriends != m->dht->num_friends) { |
2408 | sprintf(logbuffer, "Friend num in DHT %u != friend num in msger %u\n", | 2406 | LOGGER_INFO("Friend num in DHT %u != friend num in msger %u\n", m->dht->num_friends, m->numfriends); |
2409 | m->dht->num_friends, m->numfriends); | ||
2410 | loglog(logbuffer); | ||
2411 | } | 2407 | } |
2412 | 2408 | ||
2413 | uint32_t ping_lastrecv; | 2409 | uint32_t ping_lastrecv; |
@@ -2428,14 +2424,11 @@ void do_messenger(Messenger *m) | |||
2428 | if (ping_lastrecv > 999) | 2424 | if (ping_lastrecv > 999) |
2429 | ping_lastrecv = 999; | 2425 | ping_lastrecv = 999; |
2430 | 2426 | ||
2431 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u:%2u] <%s> %02i [%03u] %s\n", | 2427 | LOGGER_INFO("F[%2u:%2u] <%s> %02i [%03u] %s", |
2432 | dht2m[friend], friend, msgfptr->name, msgfptr->crypt_connection_id, | 2428 | dht2m[friend], friend, msgfptr->name, msgfptr->crypt_connection_id, |
2433 | ping_lastrecv, ID2String(msgfptr->client_id)); | 2429 | ping_lastrecv, ID2String(msgfptr->client_id)); |
2434 | loglog(logbuffer); | ||
2435 | } else { | 2430 | } else { |
2436 | snprintf(logbuffer, sizeof(logbuffer), "F[--:%2u] %s\n", | 2431 | LOGGER_INFO("F[--:%2u] %s", friend, ID2String(dhtfptr->client_id)); |
2437 | friend, ID2String(dhtfptr->client_id)); | ||
2438 | loglog(logbuffer); | ||
2439 | } | 2432 | } |
2440 | 2433 | ||
2441 | for (client = 0; client < MAX_FRIEND_CLIENTS; client++) { | 2434 | for (client = 0; client < MAX_FRIEND_CLIENTS; client++) { |
@@ -2450,19 +2443,16 @@ void do_messenger(Messenger *m) | |||
2450 | if (last_pinged > 999) | 2443 | if (last_pinged > 999) |
2451 | last_pinged = 999; | 2444 | last_pinged = 999; |
2452 | 2445 | ||
2453 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", | 2446 | LOGGER_INFO("F[%2u] => C[%2u] %s:%u [%3u] %s", |
2454 | friend, client, ip_ntoa(&assoc->ip_port.ip), | 2447 | friend, client, ip_ntoa(&assoc->ip_port.ip), |
2455 | ntohs(assoc->ip_port.port), last_pinged, | 2448 | ntohs(assoc->ip_port.port), last_pinged, |
2456 | ID2String(cptr->client_id)); | 2449 | ID2String(cptr->client_id)); |
2457 | loglog(logbuffer); | ||
2458 | } | 2450 | } |
2459 | } | 2451 | } |
2460 | } | 2452 | } |
2461 | |||
2462 | loglog(" = = = = = = = = \n"); | ||
2463 | } | 2453 | } |
2464 | 2454 | ||
2465 | #endif | 2455 | #endif /* LOGGING */ |
2466 | } | 2456 | } |
2467 | 2457 | ||
2468 | /* | 2458 | /* |