aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-09-02 12:51:26 +0000
committerChristian Grothoff <christian@grothoff.org>2012-09-02 12:51:26 +0000
commit8c7b3b9d1306ea3c78a577a42d7ebbcecfbeb9b3 (patch)
tree86c15d8ed8d7f0e5de1038d35c871e7ed1ef3a5a /src/dht
parentc9c4ef49195c329851ea68471ccddee6bdff82b4 (diff)
downloadgnunet-8c7b3b9d1306ea3c78a577a42d7ebbcecfbeb9b3.tar.gz
gnunet-8c7b3b9d1306ea3c78a577a42d7ebbcecfbeb9b3.zip
adding DHT option to disable calls to try connect
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/dht.conf.in5
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c11
2 files changed, 14 insertions, 2 deletions
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
11UNIXPATH = /tmp/gnunet-service-dht.sock 11UNIXPATH = /tmp/gnunet-service-dht.sock
12# This could be relaxed... 12# This could be relaxed...
13UNIX_MATCH_UID = YES 13UNIX_MATCH_UID = YES
14UNIX_MATCH_GID = YES 14UNIX_MATCH_GID = YESa
15# DISABLE_SOCKET_FORWARDING = NO 15# DISABLE_SOCKET_FORWARDING = NO
16# DEBUG = YES 16# DEBUG = YES
17# USERNAME = 17# USERNAME =
@@ -32,6 +32,9 @@ UNIX_MATCH_GID = YES
32# STOP_FOUND = 32# STOP_FOUND =
33# CONVERGE_MODIFIER = 33# CONVERGE_MODIFIER =
34 34
35# Special option to disable DHT calling 'try_connect' (for testing)
36DISABLE_TRY_CONNECT = NO
37
35 38
36[dhtcache] 39[dhtcache]
37DATABASE = sqlite 40DATABASE = 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
@@ -384,6 +384,11 @@ static unsigned int closest_bucket;
384static unsigned int newly_found_peers; 384static unsigned int newly_found_peers;
385 385
386/** 386/**
387 * Option for testing that disables the 'connect' function of the DHT.
388 */
389static int disable_try_connect;
390
391/**
387 * The buckets. Array of size MAX_BUCKET_SIZE. Offset 0 means 0 bits matching. 392 * The buckets. Array of size MAX_BUCKET_SIZE. Offset 0 means 0 bits matching.
388 */ 393 */
389static struct PeerBucket k_buckets[MAX_BUCKETS]; 394static struct PeerBucket k_buckets[MAX_BUCKETS];
@@ -1941,7 +1946,9 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer,
1941 if (NULL != GDS_transport_handle) 1946 if (NULL != GDS_transport_handle)
1942 { 1947 {
1943 GNUNET_TRANSPORT_offer_hello (GDS_transport_handle, h, NULL, NULL); 1948 GNUNET_TRANSPORT_offer_hello (GDS_transport_handle, h, NULL, NULL);
1944 GNUNET_TRANSPORT_try_connect (GDS_transport_handle, &pid); 1949 if (GNUNET_YES !=
1950 disable_try_connect)
1951 GNUNET_TRANSPORT_try_connect (GDS_transport_handle, &pid);
1945 } 1952 }
1946 } 1953 }
1947 } 1954 }
@@ -1998,6 +2005,8 @@ GDS_NEIGHBOURS_init ()
1998 }; 2005 };
1999 unsigned long long temp_config_num; 2006 unsigned long long temp_config_num;
2000 2007
2008 disable_try_connect
2009 = GNUNET_CONFIGURATION_get_value_yesno (GDS_cfg, "DHT", "DISABLE_TRY_CONNECT");
2001 if (GNUNET_OK == 2010 if (GNUNET_OK ==
2002 GNUNET_CONFIGURATION_get_value_number (GDS_cfg, "DHT", "bucket_size", 2011 GNUNET_CONFIGURATION_get_value_number (GDS_cfg, "DHT", "bucket_size",
2003 &temp_config_num)) 2012 &temp_config_num))