From: Matthias Wachs Date: Fri, 30 Mar 2012 10:05:03 +0000 (+0000) Subject: - debugging code for mantis 2216 X-Git-Tag: initial-import-from-subversion-38251~14056 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7f7fac1c724593de90b6e8d40796e0d10fc2694b;p=oweals%2Fgnunet.git - debugging code for mantis 2216 --- diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 3e8ef5aca..eea5d80a1 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -921,7 +921,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n) GNUNET_assert (NULL != n->address); if (n->address_state == USED) { - GST_validation_set_address_use (n->address, n->session, GNUNET_NO); + GST_validation_set_address_use (n->address, n->session, GNUNET_NO, __LINE__); GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO); n->address_state = UNUSED; } @@ -1270,7 +1270,7 @@ send_switch_address_continuation (void *cls, case S_CONNECTED: if (n->address_state == FRESH) { - GST_validation_set_address_use (cc->address, cc->session, GNUNET_YES); + GST_validation_set_address_use (cc->address, cc->session, GNUNET_YES, __LINE__); GNUNET_ATS_address_update (GST_ats, cc->address, cc->session, NULL, 0); if (cc->session != n->session) GNUNET_break (0); @@ -1291,7 +1291,7 @@ send_switch_address_continuation (void *cls, if (n->address_state == FRESH) { - GST_validation_set_address_use (cc->address, cc->session, GNUNET_YES); + GST_validation_set_address_use (cc->address, cc->session, GNUNET_YES, __LINE__); GNUNET_ATS_address_update (GST_ats, cc->address, cc->session, NULL, 0); GNUNET_ATS_address_in_use (GST_ats, cc->address, cc->session, GNUNET_YES); n->address_state = USED; @@ -1471,7 +1471,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, GNUNET_assert (NULL != n->address); if (n->address_state == USED) { - GST_validation_set_address_use (n->address, n->session, GNUNET_NO); + GST_validation_set_address_use (n->address, n->session, GNUNET_NO, __LINE__); GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO); n->address_state = UNUSED; } @@ -1802,7 +1802,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, { if (n->address_state == USED) { - GST_validation_set_address_use (n->address, n->session, GNUNET_NO); + GST_validation_set_address_use (n->address, n->session, GNUNET_NO, __LINE__); GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO); n->address_state = UNUSED; } @@ -2469,7 +2469,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, if ((n->address_state == FRESH) && (0 == GNUNET_HELLO_address_cmp(address, n->address))) { - GST_validation_set_address_use (n->address, n->session, GNUNET_YES); + GST_validation_set_address_use (n->address, n->session, GNUNET_YES, __LINE__); GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES); n->address_state = USED; } @@ -2556,7 +2556,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message, if ((n->address_state == FRESH) && (0 == GNUNET_HELLO_address_cmp(address, n->address))) { - GST_validation_set_address_use (n->address, n->session, GNUNET_YES); + GST_validation_set_address_use (n->address, n->session, GNUNET_YES, __LINE__); GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES); n->address_state = USED; } diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index a6d942497..6a13061cc 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -1211,13 +1211,16 @@ GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, * @param session the session * @param in_use GNUNET_YES if we are now using the address for a connection, * GNUNET_NO if we are no longer using the address for a connection + * @param line line of caller just for DEBUGGING! */ void GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address, struct Session *session, - int in_use) + int in_use, + int line) { struct ValidationEntry *ve; + static int last_calling_line = 0; if (NULL != address) ve = find_validation_entry (NULL, address); @@ -1229,10 +1232,16 @@ GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address, return; } if (ve->in_use == in_use) + { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "GST_validation_set_address_use: %s %s: ve->in_use %i <-> in_use %i\n", - GNUNET_i2s (&address->peer), GST_plugins_a2s (address), ve->in_use, - in_use); + "Error setting address in use for peer `%s' `%s': %s -> %s; set last time by %i, called now by %i\n", + + GNUNET_i2s (&address->peer), GST_plugins_a2s (address), + (GNUNET_NO == ve->in_use) ? "NOT USED" : "USED", + (GNUNET_NO == in_use) ? "NOT USED" : "USED", + last_calling_line, line); + } + last_calling_line = line; GNUNET_break (ve->in_use != in_use); /* should be different... */ ve->in_use = in_use; if (in_use == GNUNET_YES) diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h index 9b1063be3..dd5bcd6bf 100644 --- a/src/transport/gnunet-service-transport_validation.h +++ b/src/transport/gnunet-service-transport_validation.h @@ -52,13 +52,16 @@ GST_validation_stop (void); * address more or less often. * * @param address the address - * @param session session + * @param session the session * @param in_use GNUNET_YES if we are now using the address for a connection, * GNUNET_NO if we are no longer using the address for a connection + * @param line line of caller just for DEBUGGING! */ void GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address, - struct Session *session, int in_use); + struct Session *session, + int in_use, + int line); /**