diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-12-21 13:49:43 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-12-21 13:49:43 +0000 |
commit | b252cf4e743728b449e1d2e9611e5ea2561084d9 (patch) | |
tree | 121fba4fa7b9c47bad79b303654601f77cedc918 /src/dv | |
parent | e7355b1e5a7045953b4f8e11593f4b37b9c58e1f (diff) | |
download | gnunet-b252cf4e743728b449e1d2e9611e5ea2561084d9.tar.gz gnunet-b252cf4e743728b449e1d2e9611e5ea2561084d9.zip |
core connect changes
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 8 | ||||
-rw-r--r-- | src/dv/test_transport_api_dv.c | 16 |
2 files changed, 18 insertions, 6 deletions
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, | |||
2897 | #endif | 2897 | #endif |
2898 | uint32_t distance; | 2898 | uint32_t distance; |
2899 | 2899 | ||
2900 | /* Check for connect to self message */ | ||
2901 | if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity))) | ||
2902 | return; | ||
2903 | |||
2900 | distance = get_atsi_distance (atsi); | 2904 | distance = get_atsi_distance (atsi); |
2901 | if ((distance == DIRECT_NEIGHBOR_COST) && | 2905 | if ((distance == DIRECT_NEIGHBOR_COST) && |
2902 | (GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL)) | 2906 | (GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL)) |
@@ -2969,6 +2973,10 @@ void handle_core_disconnect (void *cls, | |||
2969 | "%s: Receives core peer disconnect message!\n", "dv"); | 2973 | "%s: Receives core peer disconnect message!\n", "dv"); |
2970 | #endif | 2974 | #endif |
2971 | 2975 | ||
2976 | /* Check for disconnect from self message */ | ||
2977 | if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity))) | ||
2978 | return; | ||
2979 | |||
2972 | neighbor = | 2980 | neighbor = |
2973 | GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey); | 2981 | GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey); |
2974 | 2982 | ||
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, | |||
547 | 547 | ||
548 | static void | 548 | static void |
549 | init_notify_peer2 (void *cls, | 549 | init_notify_peer2 (void *cls, |
550 | struct GNUNET_CORE_Handle *server, | 550 | struct GNUNET_CORE_Handle *server, |
551 | const struct GNUNET_PeerIdentity *my_identity, | 551 | const struct GNUNET_PeerIdentity *my_identity, |
552 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) | 552 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
553 | { | 553 | { |
554 | #if VERBOSE | 554 | #if VERBOSE |
555 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 555 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -597,9 +597,9 @@ static void connect_notify_peer1 (void *cls, | |||
597 | 597 | ||
598 | static void | 598 | static void |
599 | init_notify_peer1 (void *cls, | 599 | init_notify_peer1 (void *cls, |
600 | struct GNUNET_CORE_Handle *server, | 600 | struct GNUNET_CORE_Handle *server, |
601 | const struct GNUNET_PeerIdentity *my_identity, | 601 | const struct GNUNET_PeerIdentity *my_identity, |
602 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) | 602 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
603 | { | 603 | { |
604 | total_server_connections++; | 604 | total_server_connections++; |
605 | #if VERBOSE | 605 | #if VERBOSE |
@@ -877,6 +877,10 @@ static void all_connect_handler (void *cls, | |||
877 | struct TestMessageContext *temp_context; | 877 | struct TestMessageContext *temp_context; |
878 | #endif | 878 | #endif |
879 | uint32_t distance; | 879 | uint32_t distance; |
880 | |||
881 | if (0 == memcmp(&d->id, peer, sizeof(struct GNUNET_PeerIdentity))) | ||
882 | return; | ||
883 | |||
880 | distance = get_atsi_distance(atsi); | 884 | distance = get_atsi_distance(atsi); |
881 | 885 | ||
882 | #if VERBOSE | 886 | #if VERBOSE |