From: Nathan S. Evans Date: Tue, 21 Dec 2010 13:49:43 +0000 (+0000) Subject: core connect changes X-Git-Tag: initial-import-from-subversion-38251~19488 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b252cf4e743728b449e1d2e9611e5ea2561084d9;p=oweals%2Fgnunet.git core connect changes --- diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 28362b82f..0ef8d48f7 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -2897,6 +2897,10 @@ handle_core_connect (void *cls, #endif uint32_t distance; + /* Check for connect to self message */ + if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity))) + return; + distance = get_atsi_distance (atsi); if ((distance == DIRECT_NEIGHBOR_COST) && (GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL)) @@ -2969,6 +2973,10 @@ void handle_core_disconnect (void *cls, "%s: Receives core peer disconnect message!\n", "dv"); #endif + /* Check for disconnect from self message */ + if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity))) + return; + neighbor = GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey); diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index c37448342..48e30ada0 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c @@ -547,9 +547,9 @@ static void connect_notify_peer2 (void *cls, static void init_notify_peer2 (void *cls, - struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + struct GNUNET_CORE_Handle *server, + const struct GNUNET_PeerIdentity *my_identity, + const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) { #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -597,9 +597,9 @@ static void connect_notify_peer1 (void *cls, static void init_notify_peer1 (void *cls, - struct GNUNET_CORE_Handle *server, - const struct GNUNET_PeerIdentity *my_identity, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) + struct GNUNET_CORE_Handle *server, + const struct GNUNET_PeerIdentity *my_identity, + const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) { total_server_connections++; #if VERBOSE @@ -877,6 +877,10 @@ static void all_connect_handler (void *cls, struct TestMessageContext *temp_context; #endif uint32_t distance; + + if (0 == memcmp(&d->id, peer, sizeof(struct GNUNET_PeerIdentity))) + return; + distance = get_atsi_distance(atsi); #if VERBOSE