From 8c7b3b9d1306ea3c78a577a42d7ebbcecfbeb9b3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 2 Sep 2012 12:51:26 +0000 Subject: adding DHT option to disable calls to try connect --- src/dht/dht.conf.in | 5 ++++- src/dht/gnunet-service-dht_neighbours.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/dht') diff --git a/src/dht/dht.conf.in b/src/dht/dht.conf.in index 59581dc7b..9a6c47d9c 100644 --- a/src/dht/dht.conf.in +++ b/src/dht/dht.conf.in @@ -11,7 +11,7 @@ BUCKET_SIZE = 4 UNIXPATH = /tmp/gnunet-service-dht.sock # This could be relaxed... UNIX_MATCH_UID = YES -UNIX_MATCH_GID = YES +UNIX_MATCH_GID = YESa # DISABLE_SOCKET_FORWARDING = NO # DEBUG = YES # USERNAME = @@ -32,6 +32,9 @@ UNIX_MATCH_GID = YES # STOP_FOUND = # CONVERGE_MODIFIER = +# Special option to disable DHT calling 'try_connect' (for testing) +DISABLE_TRY_CONNECT = NO + [dhtcache] DATABASE = sqlite diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index fdbb29371..7401eb8ac 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -383,6 +383,11 @@ static unsigned int closest_bucket; */ static unsigned int newly_found_peers; +/** + * Option for testing that disables the 'connect' function of the DHT. + */ +static int disable_try_connect; + /** * The buckets. Array of size MAX_BUCKET_SIZE. Offset 0 means 0 bits matching. */ @@ -1941,7 +1946,9 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, if (NULL != GDS_transport_handle) { GNUNET_TRANSPORT_offer_hello (GDS_transport_handle, h, NULL, NULL); - GNUNET_TRANSPORT_try_connect (GDS_transport_handle, &pid); + if (GNUNET_YES != + disable_try_connect) + GNUNET_TRANSPORT_try_connect (GDS_transport_handle, &pid); } } } @@ -1998,6 +2005,8 @@ GDS_NEIGHBOURS_init () }; unsigned long long temp_config_num; + disable_try_connect + = GNUNET_CONFIGURATION_get_value_yesno (GDS_cfg, "DHT", "DISABLE_TRY_CONNECT"); if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GDS_cfg, "DHT", "bucket_size", &temp_config_num)) -- cgit v1.2.3