- next test
[oweals/gnunet.git] / src / gns / gnunet-service-gns_resolver.c
index 80a2785b86d0ed3842a87a3423f8fe7f379ee380..cea423fc723f9972f74f212c0a11968a36d647bd 100644 (file)
@@ -33,7 +33,7 @@
 #include "gnunet_dns_service.h"
 #include "gnunet_resolver_service.h"
 #include "gnunet_dnsparser_lib.h"
-#include "../dns/dnsparser.h"
+#include "gns_protocol.h"
 #include "gnunet_gns_service.h"
 #include "block_gns.h"
 #include "gns.h"
@@ -309,9 +309,10 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph, char* name)
     GNUNET_CRYPTO_rsa_key_free (gph->key);
     GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph);
     GNUNET_free (gph);
+    return;
   }
-  else
-    memcpy (gph->test_name, name, strlen(name)+1);
+  
+  memcpy (gph->test_name, name, strlen(name)+1);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "GNS_AUTO_PSEU: Checking %s for collision in NS\n",
@@ -589,9 +590,7 @@ start_shorten (struct AuthorityChain *auth,
   struct GetPseuAuthorityHandle *gph;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
   struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pb_key;
-
-  gph = GNUNET_malloc (sizeof (struct GetPseuAuthorityHandle));
-
+  
   GNUNET_CRYPTO_rsa_key_get_public (key, &pkey);
   pb_key = GNUNET_CRYPTO_rsa_encode_key (key);
 
@@ -921,15 +920,18 @@ on_namestore_record_put_result (void *cls,
              "GNS_NS: Error putting records into namestore: %s\n", emsg);
 }
 
+
 static void
 handle_lookup_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct ResolverHandle *rh = cls;
 
-  if (rh->timeout_cont)
+  if (NULL != rh->timeout_cont)
     rh->timeout_cont (rh->timeout_cont_cls, tc);
+  /* FIXME: does this leak memory? */
 }
 
+
 /**
  * Processor for background lookups in the DHT
  *
@@ -3474,8 +3476,10 @@ gns_resolver_lookup_record (struct GNUNET_CRYPTO_ShortHashCode zone,
                                                       &rh->authority))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    "Cannot convert ZKEY %s to hash!\n", string_hash);
+                    "Cannot convert ZKEY `%s' to hash!\n", string_hash);
         
+       if (GNUNET_SCHEDULER_NO_TASK != rh->timeout_task)
+         GNUNET_SCHEDULER_cancel (rh->timeout_task);
         GNUNET_CONTAINER_DLL_remove (rlh_head, rlh_tail, rh);
         GNUNET_free (rh);
         GNUNET_free (rlh);