diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-02-16 14:55:07 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-02-16 14:55:07 +0000 |
commit | d719b32495bed06aa3fe7b1594cccf41a70bd66c (patch) | |
tree | c21c33b120ee84094bcc8b154d5670febda0d926 /src/gns | |
parent | 99fc0eceee3c145ce5bf3a38502e23b922a8af00 (diff) | |
download | gnunet-d719b32495bed06aa3fe7b1594cccf41a70bd66c.tar.gz gnunet-d719b32495bed06aa3fe7b1594cccf41a70bd66c.zip |
force not using DHT for lookups that are only in the master zone (#3325)
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/gnunet-gns.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 33d4b9206..aa35e7281 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -61,6 +61,11 @@ static char *zone_ego_name; | |||
61 | static char *public_key; | 61 | static char *public_key; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Set to #GNUNET_YES if we must not use the DHT (only local lookup). | ||
65 | */ | ||
66 | static int only_cached; | ||
67 | |||
68 | /** | ||
64 | * raw output | 69 | * raw output |
65 | */ | 70 | */ |
66 | static int raw; | 71 | static int raw; |
@@ -206,7 +211,7 @@ lookup_with_keys (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey, | |||
206 | lookup_name, | 211 | lookup_name, |
207 | pkey, | 212 | pkey, |
208 | rtype, | 213 | rtype, |
209 | GNUNET_NO, /* Use DHT */ | 214 | only_cached, |
210 | shorten_key, | 215 | shorten_key, |
211 | &process_lookup_result, | 216 | &process_lookup_result, |
212 | lookup_name); | 217 | lookup_name); |
@@ -328,6 +333,7 @@ identity_master_cb (void *cls, | |||
328 | const char *name) | 333 | const char *name) |
329 | { | 334 | { |
330 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 335 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
336 | const char *dot; | ||
331 | 337 | ||
332 | id_op = NULL; | 338 | id_op = NULL; |
333 | if (NULL == ego) | 339 | if (NULL == ego) |
@@ -338,6 +344,11 @@ identity_master_cb (void *cls, | |||
338 | return; | 344 | return; |
339 | } | 345 | } |
340 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); | 346 | GNUNET_IDENTITY_ego_get_public_key (ego, &pkey); |
347 | /* if the name is of the form 'label.gnu', never go to the DHT */ | ||
348 | dot = strchr (lookup_name, '.'); | ||
349 | if ( (NULL != dot) && | ||
350 | (0 == strcasecmp (dot, ".gnu")) ) | ||
351 | only_cached = GNUNET_YES; | ||
341 | lookup_with_public_key (&pkey); | 352 | lookup_with_public_key (&pkey); |
342 | } | 353 | } |
343 | 354 | ||