diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-03-12 15:52:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-03-12 15:52:54 +0000 |
commit | 5e91a0f51e433d0b5eea7deff728d63cd59e9d6a (patch) | |
tree | c357cf0b2956b09d5f53360d3367e26cb3412042 | |
parent | 81319e2d948d9e36e88078e92759a9f2c1749023 (diff) | |
download | gnunet-5e91a0f51e433d0b5eea7deff728d63cd59e9d6a.tar.gz gnunet-5e91a0f51e433d0b5eea7deff728d63cd59e9d6a.zip |
only notify when desired
-rw-r--r-- | src/core/gnunet-service-core.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 67b73b2b5..1dd7e1d8b 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -885,24 +885,27 @@ handle_client_init (void *cls, | |||
885 | "Sending `%s' message to client.\n", "INIT_REPLY"); | 885 | "Sending `%s' message to client.\n", "INIT_REPLY"); |
886 | #endif | 886 | #endif |
887 | send_to_client (c, &irm.header, GNUNET_NO); | 887 | send_to_client (c, &irm.header, GNUNET_NO); |
888 | /* notify new client about existing neighbours */ | 888 | if (c->options & GNUNET_CORE_OPTION_SEND_CONNECT) |
889 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | ||
890 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | ||
891 | n = neighbours; | ||
892 | while (n != NULL) | ||
893 | { | 889 | { |
894 | if (n->status == PEER_STATE_KEY_CONFIRMED) | 890 | /* notify new client about existing neighbours */ |
891 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | ||
892 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | ||
893 | n = neighbours; | ||
894 | while (n != NULL) | ||
895 | { | 895 | { |
896 | if (n->status == PEER_STATE_KEY_CONFIRMED) | ||
897 | { | ||
896 | #if DEBUG_CORE_CLIENT | 898 | #if DEBUG_CORE_CLIENT |
897 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 899 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
898 | "Sending `%s' message to client.\n", "NOTIFY_CONNECT"); | 900 | "Sending `%s' message to client.\n", "NOTIFY_CONNECT"); |
899 | #endif | 901 | #endif |
900 | cnm.distance = htonl (n->last_distance); | 902 | cnm.distance = htonl (n->last_distance); |
901 | cnm.latency = GNUNET_TIME_relative_hton (n->last_latency); | 903 | cnm.latency = GNUNET_TIME_relative_hton (n->last_latency); |
902 | cnm.peer = n->peer; | 904 | cnm.peer = n->peer; |
903 | send_to_client (c, &cnm.header, GNUNET_NO); | 905 | send_to_client (c, &cnm.header, GNUNET_NO); |
906 | } | ||
907 | n = n->next; | ||
904 | } | 908 | } |
905 | n = n->next; | ||
906 | } | 909 | } |
907 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 910 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
908 | } | 911 | } |