From 72a2c1b9542d68eab32f483a1c53eeec19bc12b3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Feb 2015 14:28:45 +0000 Subject: -do only send HELLO to clients once on startup, do only send fully initialized HELLO to clients if we can help it, even the first one; do not perform blacklist check twice for try_connect --- src/transport/gnunet-service-transport.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/transport/gnunet-service-transport.c') diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 336925f4f..65519914a 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -215,6 +215,11 @@ transmit_our_hello (void *cls, { const struct GNUNET_MessageHeader *hello = cls; + if (0 == + memcmp (peer, + &GST_my_identity, + sizeof (struct GNUNET_PeerIdentity))) + return; /* not to ourselves */ if (GNUNET_NO == GST_neighbours_test_connected (peer)) return; @@ -236,8 +241,13 @@ static void process_hello_update (void *cls, const struct GNUNET_MessageHeader *hello) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Broadcasting HELLO to clients\n"); GST_clients_broadcast (hello, GNUNET_NO); - GST_neighbours_iterate (&transmit_our_hello, (void *) hello); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Broadcasting HELLO to neighbours\n"); + GST_neighbours_iterate (&transmit_our_hello, + (void *) hello); } @@ -1051,14 +1061,18 @@ run (void *cls, "Limiting number of sockets to %u: validation %u, neighbors: %u\n", max_fd, (max_fd / 3), (max_fd / 3) * 2); - friend_only = GNUNET_CONFIGURATION_get_value_yesno (GST_cfg, "topology", - "FRIENDS-ONLY"); + friend_only = GNUNET_CONFIGURATION_get_value_yesno (GST_cfg, + "topology", + "FRIENDS-ONLY"); if (GNUNET_SYSERR == friend_only) friend_only = GNUNET_NO; /* According to topology defaults */ /* start subsystems */ - GST_hello_start (friend_only, &process_hello_update, NULL ); - GNUNET_assert(NULL != GST_hello_get()); - GST_blacklist_start (GST_server, GST_cfg, &GST_my_identity); + GST_hello_start (friend_only, + &process_hello_update, + NULL); + GST_blacklist_start (GST_server, + GST_cfg, + &GST_my_identity); is = GNUNET_ATS_scanner_init (); GST_ats_connect = GNUNET_ATS_connectivity_init (GST_cfg); GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, -- cgit v1.2.3