-fixes
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Tue, 10 Apr 2012 12:10:43 +0000 (12:10 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Tue, 10 Apr 2012 12:10:43 +0000 (12:10 +0000)
src/gns/gnunet-service-gns_resolver.c
src/gns/test_gns_defaults.conf
src/gns/test_gns_pseu_shorten.c
src/gns/test_gns_simple_lookup.conf

index 57fbef8b28f1087591cf9dba560dc4576e141cd5..9959c43d57405e1acb2ed7ef6a95b3b243109c2e 100644 (file)
@@ -1762,6 +1762,10 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh,
 {
   struct RecordLookupHandle* rlh;
   rlh = (struct RecordLookupHandle*) cls;
+
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "GNS_PHASE_DELEGATE_NS-%llu: Resolution status: %d.\n",
+             rh->id, rh->status);
   
   if (strcmp(rh->name, "") == 0)
   {
@@ -1791,7 +1795,7 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh,
    * and exists
    * or we are authority
    **/
-  if (((rh->status & RSL_RECORD_EXISTS) && (rh->status & !RSL_RECORD_EXPIRED))
+  if (((rh->status & RSL_RECORD_EXISTS) && (!(rh->status & RSL_RECORD_EXPIRED)))
       || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
                                        &local_zone))
   {
@@ -1868,11 +1872,17 @@ process_delegation_result_ns(void* cls,
   
   if (name != NULL)
   {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "GNS_PHASE_DELEGATE_NS-%llu: Records with name %s exist.\n",
+               rh->id, name);
     rh->status |= RSL_RECORD_EXISTS;
   }
   
   if (remaining_time.rel_value == 0)
   {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "GNS_PHASE_DELEGATE_NS-%llu: Record set %s expired.\n",
+               rh->id, name);
     rh->status |= RSL_RECORD_EXPIRED;
   }
   
@@ -1994,7 +2004,23 @@ process_delegation_result_ns(void* cls,
    */
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
     "GNS_PHASE_DELEGATE_NS-%llu: Authority lookup and no PKEY...\n", rh->id);
-  rh->proc(rh->proc_cls, rh, 0, NULL);
+  /**
+   * If we have found some records for the LAST label
+   * we return the results. Else null.
+   */
+  if (strcmp(rh->name, "") == 0)
+  {
+    /* simply promote back */
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "GNS_PHASE_DELEGATE_NS-%llu: Promoting %s back to name\n",
+               rh->id, rh->authority_name);
+    strcpy(rh->name, rh->authority_name);
+    rh->proc(rh->proc_cls, rh, rd_count, rd);
+  }
+  else
+  {
+    rh->proc(rh->proc_cls, rh, 0, NULL);
+  }
 }
 
 
@@ -2013,7 +2039,7 @@ resolve_delegation_ns(struct ResolverHandle *rh)
   GNUNET_NAMESTORE_lookup_record(namestore_handle,
                                  &rh->authority,
                                  rh->authority_name,
-                                 GNUNET_GNS_RECORD_PKEY,
+                                 GNUNET_GNS_RECORD_ANY,
                                  &process_delegation_result_ns,
                                  rh);
 
index 762c9641b455219c8c25365c5e6edd8d8f4302fd..b7e68ff8553fcf47afb0dbb607bedcfa6addc400 100644 (file)
@@ -67,9 +67,3 @@ AUTOSTART = NO
 
 [vpn]
 AUTOSTART = NO
-
-[gns]
-AUTOSTART = NO
-
-[namestore]
-AUTOSTART = NO
\ No newline at end of file
index e0a6760e42d6c9bbda867bf17324bf8474e02820..3ceeaa32c550b5a41d764a39ea7a10f8e9158ee1 100644 (file)
@@ -103,6 +103,13 @@ shutdown_callback (void *cls, const char *emsg)
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok);
 }
 
+static void
+disco_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_DHT_disconnect(dht_handle);
+  dht_handle = NULL;
+}
+
 /**
  * Called when gns shorten finishes
  */
@@ -110,6 +117,7 @@ static void
 process_shorten_result(void* cls, const char* sname)
 {
   GNUNET_GNS_disconnect(gns_handle);
+  //GNUNET_SCHEDULER_add_now(disco_dht, NULL);
   ok = 0;
 
   if (sname == NULL)
@@ -196,7 +204,8 @@ on_lookup_result(void *cls, uint32_t rd_count,
 static void
 commence_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_DHT_disconnect(dht_handle);
+  GNUNET_SCHEDULER_add_now(disco_dht, NULL);
+  //GNUNET_DHT_disconnect(dht_handle);
 
   GNUNET_CRYPTO_rsa_key_free(our_key);
   GNUNET_CRYPTO_rsa_key_free(bob_key);
@@ -595,7 +604,7 @@ check ()
   if (ret != GNUNET_OK)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-gns-dht-delegated-lookup': Failed with error code %d\n", ret);
+                "`test-gns-pseu-shorten': Failed with error code %d\n", ret);
   }
   return ok;
 }
@@ -605,7 +614,7 @@ main (int argc, char *argv[])
 {
   int ret;
 
-  GNUNET_log_setup ("test-gns-simple-lookup",
+  GNUNET_log_setup ("test-gns-pseu-shorten",
 #if VERBOSE
                     "DEBUG",
 #else
index 9a21ebc9da749c475055cc2ac57a7ce7cdd04e8d..410fe63194c505f830adb09da90304222cae879f 100644 (file)
@@ -16,7 +16,7 @@ PORT = 2100
 BINARY = gnunet-service-dht
 
 [block]
-plugins = dht test namestore gns
+plugins = dht test gns
 
 [dhtcache]
 QUOTA = 1 MB