From: Nathan S. Evans Date: Fri, 17 Jun 2011 16:52:53 +0000 (+0000) Subject: remove disconnects which are clearly being used improperly. Not a permanent commit... X-Git-Tag: initial-import-from-subversion-38251~18090 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=48e69fe1cea624af0a54148cfcc802b35782cf51;p=oweals%2Fgnunet.git remove disconnects which are clearly being used improperly. Not a permanent commit, just to check if BB testcases will now pass --- diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 74e944cd7..8ebd8d0e9 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -2493,7 +2493,7 @@ try_fast_reconnect (struct TransportPlugin *p, * GNUNET_NO in the call below makes transport disconnect the peer, * even if only a single address (out of say, six) went away. This * function must be careful to ONLY disconnect if the peer is gone, - * not just a specifi address. + * not just a specific address. * * More specifically, half the places it was used had it WRONG. */ @@ -2504,7 +2504,13 @@ try_fast_reconnect (struct TransportPlugin *p, "Disconnecting peer `%4s', %s\n", GNUNET_i2s(&nl->id), "try_fast_reconnect"); #endif + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to try_fast_reconnect"), + 1, + GNUNET_NO); +#if DISCONNECT disconnect_neighbour (nl, GNUNET_YES); +#endif } @@ -2563,6 +2569,10 @@ plugin_env_session_end (void *cls, "Plugin was associated with peer `%4s'\n", GNUNET_i2s(peer)); #endif + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to session end"), + 1, + GNUNET_NO); disconnect_neighbour (nl, GNUNET_YES); return; } @@ -2582,6 +2592,10 @@ plugin_env_session_end (void *cls, GNUNET_i2s(peer)); #endif //FIXME: This conflicts with inbound tcp connections and tcp nat ... debugging in progress + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to unready session"), + 1, + GNUNET_NO); disconnect_neighbour (nl, GNUNET_YES); return; /* was never marked as connected */ } @@ -2589,9 +2603,21 @@ plugin_env_session_end (void *cls, if (pos->addrlen != 0) { if (nl->received_pong != GNUNET_NO) - try_fast_reconnect (p, nl); + { + GNUNET_STATISTICS_update (stats, + gettext_noop ("# try_fast_reconnect thanks to plugin_env_session_end"), + 1, + GNUNET_NO); + try_fast_reconnect (p, nl); + } else - disconnect_neighbour (nl, GNUNET_YES); + { + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to missing pong"), + 1, + GNUNET_NO); + disconnect_neighbour (nl, GNUNET_YES); + } return; } /* was inbound connection, free 'pos' */ @@ -2610,6 +2636,10 @@ plugin_env_session_end (void *cls, ats->stat.recreate_problem = GNUNET_YES; if (nl->received_pong == GNUNET_NO) { + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to NO pong"), + 1, + GNUNET_NO); disconnect_neighbour (nl, GNUNET_YES); return; /* nothing to do, never connected... */ } @@ -2619,6 +2649,10 @@ plugin_env_session_end (void *cls, { if (pos->validated) { + GNUNET_STATISTICS_update (stats, + gettext_noop ("# try_fast_reconnect thanks to validated_address"), + 1, + GNUNET_NO); try_fast_reconnect (p, nl); return; } @@ -2639,7 +2673,13 @@ plugin_env_session_end (void *cls, * if there are any addresses that work first, so as not to overdo it. * --NE */ + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to try-fast-reconnect"), + 1, + GNUNET_NO); +#if DISCONNECT disconnect_neighbour (nl, GNUNET_YES); +#endif } @@ -3672,6 +3712,10 @@ confirm_or_drop_neighbour (void *cls, "Disconnecting peer `%4s', %s\n", GNUNET_i2s(&orig->id), "confirm_or_drop_neighboUr"); #endif + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to blacklist"), + 1, + GNUNET_NO); disconnect_neighbour (orig, GNUNET_NO); } } @@ -5816,6 +5860,10 @@ handle_set_quota (void *cls, "Disconnecting peer `%4s', %s\n", GNUNET_i2s(&n->id), "SET_QUOTA"); #endif + GNUNET_STATISTICS_update (stats, + gettext_noop ("# disconnects due to quota of 0"), + 1, + GNUNET_NO); disconnect_neighbour (n, GNUNET_NO); } GNUNET_SERVER_receive_done (client, GNUNET_OK);