only notify when desired
authorChristian Grothoff <christian@grothoff.org>
Fri, 12 Mar 2010 15:52:54 +0000 (15:52 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 12 Mar 2010 15:52:54 +0000 (15:52 +0000)
src/core/gnunet-service-core.c

index 67b73b2b5cf4a4d4008f18c92e92880e443f5b67..1dd7e1d8bd7bcd65fd93772ee6b8199b2a21e195 100644 (file)
@@ -885,24 +885,27 @@ handle_client_init (void *cls,
               "Sending `%s' message to client.\n", "INIT_REPLY");
 #endif
   send_to_client (c, &irm.header, GNUNET_NO);
-  /* notify new client about existing neighbours */
-  cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
-  cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
-  n = neighbours;
-  while (n != NULL)
+  if (c->options & GNUNET_CORE_OPTION_SEND_CONNECT)
     {
-      if (n->status == PEER_STATE_KEY_CONFIRMED)
+      /* notify new client about existing neighbours */
+      cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
+      cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
+      n = neighbours;
+      while (n != NULL)
        {
+         if (n->status == PEER_STATE_KEY_CONFIRMED)
+           {
 #if DEBUG_CORE_CLIENT
-         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                     "Sending `%s' message to client.\n", "NOTIFY_CONNECT");
+             GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                         "Sending `%s' message to client.\n", "NOTIFY_CONNECT");
 #endif
-         cnm.distance = htonl (n->last_distance);
-         cnm.latency = GNUNET_TIME_relative_hton (n->last_latency);
-         cnm.peer = n->peer;
-         send_to_client (c, &cnm.header, GNUNET_NO);
+             cnm.distance = htonl (n->last_distance);
+             cnm.latency = GNUNET_TIME_relative_hton (n->last_latency);
+             cnm.peer = n->peer;
+             send_to_client (c, &cnm.header, GNUNET_NO);
+           }
+         n = n->next;
        }
-      n = n->next;
     }
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }