aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-04-10 12:10:43 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-04-10 12:10:43 +0000
commit1659cd0336ac7493d02ca04b30ba2600df778c4d (patch)
treea134bf6a8e18c64259527866a8072e5569db3a6f /src/gns
parent16349a2370933c25901ecca6f19bea3ad1208783 (diff)
downloadgnunet-1659cd0336ac7493d02ca04b30ba2600df778c4d.tar.gz
gnunet-1659cd0336ac7493d02ca04b30ba2600df778c4d.zip
-fixes
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gnunet-service-gns_resolver.c32
-rw-r--r--src/gns/test_gns_defaults.conf6
-rw-r--r--src/gns/test_gns_pseu_shorten.c15
-rw-r--r--src/gns/test_gns_simple_lookup.conf2
4 files changed, 42 insertions, 13 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 57fbef8b2..9959c43d5 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1762,6 +1762,10 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh,
1762{ 1762{
1763 struct RecordLookupHandle* rlh; 1763 struct RecordLookupHandle* rlh;
1764 rlh = (struct RecordLookupHandle*) cls; 1764 rlh = (struct RecordLookupHandle*) cls;
1765
1766 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1767 "GNS_PHASE_DELEGATE_NS-%llu: Resolution status: %d.\n",
1768 rh->id, rh->status);
1765 1769
1766 if (strcmp(rh->name, "") == 0) 1770 if (strcmp(rh->name, "") == 0)
1767 { 1771 {
@@ -1791,7 +1795,7 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh,
1791 * and exists 1795 * and exists
1792 * or we are authority 1796 * or we are authority
1793 **/ 1797 **/
1794 if (((rh->status & RSL_RECORD_EXISTS) && (rh->status & !RSL_RECORD_EXPIRED)) 1798 if (((rh->status & RSL_RECORD_EXISTS) && (!(rh->status & RSL_RECORD_EXPIRED)))
1795 || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, 1799 || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
1796 &local_zone)) 1800 &local_zone))
1797 { 1801 {
@@ -1868,11 +1872,17 @@ process_delegation_result_ns(void* cls,
1868 1872
1869 if (name != NULL) 1873 if (name != NULL)
1870 { 1874 {
1875 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1876 "GNS_PHASE_DELEGATE_NS-%llu: Records with name %s exist.\n",
1877 rh->id, name);
1871 rh->status |= RSL_RECORD_EXISTS; 1878 rh->status |= RSL_RECORD_EXISTS;
1872 } 1879 }
1873 1880
1874 if (remaining_time.rel_value == 0) 1881 if (remaining_time.rel_value == 0)
1875 { 1882 {
1883 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1884 "GNS_PHASE_DELEGATE_NS-%llu: Record set %s expired.\n",
1885 rh->id, name);
1876 rh->status |= RSL_RECORD_EXPIRED; 1886 rh->status |= RSL_RECORD_EXPIRED;
1877 } 1887 }
1878 1888
@@ -1994,7 +2004,23 @@ process_delegation_result_ns(void* cls,
1994 */ 2004 */
1995 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 2005 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1996 "GNS_PHASE_DELEGATE_NS-%llu: Authority lookup and no PKEY...\n", rh->id); 2006 "GNS_PHASE_DELEGATE_NS-%llu: Authority lookup and no PKEY...\n", rh->id);
1997 rh->proc(rh->proc_cls, rh, 0, NULL); 2007 /**
2008 * If we have found some records for the LAST label
2009 * we return the results. Else null.
2010 */
2011 if (strcmp(rh->name, "") == 0)
2012 {
2013 /* simply promote back */
2014 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2015 "GNS_PHASE_DELEGATE_NS-%llu: Promoting %s back to name\n",
2016 rh->id, rh->authority_name);
2017 strcpy(rh->name, rh->authority_name);
2018 rh->proc(rh->proc_cls, rh, rd_count, rd);
2019 }
2020 else
2021 {
2022 rh->proc(rh->proc_cls, rh, 0, NULL);
2023 }
1998} 2024}
1999 2025
2000 2026
@@ -2013,7 +2039,7 @@ resolve_delegation_ns(struct ResolverHandle *rh)
2013 GNUNET_NAMESTORE_lookup_record(namestore_handle, 2039 GNUNET_NAMESTORE_lookup_record(namestore_handle,
2014 &rh->authority, 2040 &rh->authority,
2015 rh->authority_name, 2041 rh->authority_name,
2016 GNUNET_GNS_RECORD_PKEY, 2042 GNUNET_GNS_RECORD_ANY,
2017 &process_delegation_result_ns, 2043 &process_delegation_result_ns,
2018 rh); 2044 rh);
2019 2045
diff --git a/src/gns/test_gns_defaults.conf b/src/gns/test_gns_defaults.conf
index 762c9641b..b7e68ff85 100644
--- a/src/gns/test_gns_defaults.conf
+++ b/src/gns/test_gns_defaults.conf
@@ -67,9 +67,3 @@ AUTOSTART = NO
67 67
68[vpn] 68[vpn]
69AUTOSTART = NO 69AUTOSTART = NO
70
71[gns]
72AUTOSTART = NO
73
74[namestore]
75AUTOSTART = NO \ No newline at end of file
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c
index e0a6760e4..3ceeaa32c 100644
--- a/src/gns/test_gns_pseu_shorten.c
+++ b/src/gns/test_gns_pseu_shorten.c
@@ -103,6 +103,13 @@ shutdown_callback (void *cls, const char *emsg)
103 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok); 103 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok);
104} 104}
105 105
106static void
107disco_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
108{
109 GNUNET_DHT_disconnect(dht_handle);
110 dht_handle = NULL;
111}
112
106/** 113/**
107 * Called when gns shorten finishes 114 * Called when gns shorten finishes
108 */ 115 */
@@ -110,6 +117,7 @@ static void
110process_shorten_result(void* cls, const char* sname) 117process_shorten_result(void* cls, const char* sname)
111{ 118{
112 GNUNET_GNS_disconnect(gns_handle); 119 GNUNET_GNS_disconnect(gns_handle);
120 //GNUNET_SCHEDULER_add_now(disco_dht, NULL);
113 ok = 0; 121 ok = 0;
114 122
115 if (sname == NULL) 123 if (sname == NULL)
@@ -196,7 +204,8 @@ on_lookup_result(void *cls, uint32_t rd_count,
196static void 204static void
197commence_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 205commence_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
198{ 206{
199 GNUNET_DHT_disconnect(dht_handle); 207 GNUNET_SCHEDULER_add_now(disco_dht, NULL);
208 //GNUNET_DHT_disconnect(dht_handle);
200 209
201 GNUNET_CRYPTO_rsa_key_free(our_key); 210 GNUNET_CRYPTO_rsa_key_free(our_key);
202 GNUNET_CRYPTO_rsa_key_free(bob_key); 211 GNUNET_CRYPTO_rsa_key_free(bob_key);
@@ -595,7 +604,7 @@ check ()
595 if (ret != GNUNET_OK) 604 if (ret != GNUNET_OK)
596 { 605 {
597 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 606 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
598 "`test-gns-dht-delegated-lookup': Failed with error code %d\n", ret); 607 "`test-gns-pseu-shorten': Failed with error code %d\n", ret);
599 } 608 }
600 return ok; 609 return ok;
601} 610}
@@ -605,7 +614,7 @@ main (int argc, char *argv[])
605{ 614{
606 int ret; 615 int ret;
607 616
608 GNUNET_log_setup ("test-gns-simple-lookup", 617 GNUNET_log_setup ("test-gns-pseu-shorten",
609#if VERBOSE 618#if VERBOSE
610 "DEBUG", 619 "DEBUG",
611#else 620#else
diff --git a/src/gns/test_gns_simple_lookup.conf b/src/gns/test_gns_simple_lookup.conf
index 9a21ebc9d..410fe6319 100644
--- a/src/gns/test_gns_simple_lookup.conf
+++ b/src/gns/test_gns_simple_lookup.conf
@@ -16,7 +16,7 @@ PORT = 2100
16BINARY = gnunet-service-dht 16BINARY = gnunet-service-dht
17 17
18[block] 18[block]
19plugins = dht test namestore gns 19plugins = dht test gns
20 20
21[dhtcache] 21[dhtcache]
22QUOTA = 1 MB 22QUOTA = 1 MB