fix
[oweals/gnunet.git] / src / gns / test_gns_simple_zkey_lookup.c
index 3a0496404dd76db9f7cb24e2ef573ff477b9456c..136b3b7db2cc36a15ccc90ffdaf6a47a5dfcd4ba 100644 (file)
@@ -37,7 +37,7 @@
 #define VERBOSE GNUNET_YES
 
 /* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 40)
 
 /* If number of peers not in config file, use this number */
 #define DEFAULT_NUM_PEERS 2
@@ -97,10 +97,11 @@ on_lookup_result(void *cls, uint32_t rd_count,
   int i;
   char* addr;
   
+  GNUNET_NAMESTORE_disconnect (namestore_handle);
   if (rd_count == 0)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Lookup failed, rp_filtering?\n");
+                "Lookup failed\n");
     ok = 2;
   }
   else
@@ -110,7 +111,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
     for (i=0; i<rd_count; i++)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
-      if (rd[i].record_type == GNUNET_GNS_RECORD_TYPE_A)
+      if (rd[i].record_type == GNUNET_GNS_RECORD_A)
       {
         memcpy(&a, rd[i].data, sizeof(a));
         addr = inet_ntoa(a);
@@ -145,7 +146,6 @@ commence_testing (void *cls, int32_t success, const char *emsg)
   char* pos;
   struct GNUNET_CRYPTO_ShortHashAsciiEncoded hash_str;
   
-  GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES);
 
   gns_handle = GNUNET_GNS_connect(cfg);
 
@@ -167,7 +167,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
   pos++;
   strcpy(pos, GNUNET_GNS_TLD_ZKEY);
 
-  GNUNET_GNS_lookup(gns_handle, name, GNUNET_GNS_RECORD_TYPE_A,
+  GNUNET_GNS_lookup(gns_handle, name, GNUNET_GNS_RECORD_A,
                     GNUNET_NO,
                     NULL,
                     &on_lookup_result, NULL);
@@ -251,7 +251,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
   rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
   rd.data = &bob_hash;
   rd.record_type = GNUNET_GNS_RECORD_PKEY;
-  rd.flags = 0;
+  rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
 
   GNUNET_NAMESTORE_record_create (namestore_handle,
                                   alice_key,
@@ -314,12 +314,9 @@ check ()
   int ret;
 
   /* Arguments for GNUNET_PROGRAM_run */
-  char *const argv[] = { "test-gns-simple-delegated-lookup", /* Name to give running binary */
+  char *const argv[] = { "test-gns-simple-zkey-lookup", /* Name to give running binary */
     "-c",
     "test_gns_simple_lookup.conf",       /* Config file to use */
-#if VERBOSE
-    "-L", "DEBUG",
-#endif
     NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -328,12 +325,12 @@ check ()
   /* Run the run function as a new program */
   ret =
       GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                          "test-gns-simple-delegated-lookup", "nohelp", options, &run,
+                          "test-gns-simple-zkey-lookup", "nohelp", options, &run,
                           &ok);
   if (ret != GNUNET_OK)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "`test-gns-simple-delegated-lookup': Failed with error code %d\n", ret);
+                "`test-gns-simple-zkey-lookup': Failed with error code %d\n", ret);
   }
   return ok;
 }
@@ -343,12 +340,8 @@ main (int argc, char *argv[])
 {
   int ret;
 
-  GNUNET_log_setup ("test-gns-simple-lookup",
-#if VERBOSE
-                    "DEBUG",
-#else
+  GNUNET_log_setup ("test-gns-simple-zkey-lookup",
                     "WARNING",
-#endif
                     NULL);
   ret = check ();
   /**