-fix client receive, zonefile loading
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Thu, 15 Mar 2012 11:25:16 +0000 (11:25 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Thu, 15 Mar 2012 11:25:16 +0000 (11:25 +0000)
src/gns/gns.conf.in
src/gns/gns_api.c
src/gns/gnunet-service-gns.c
src/gns/test_gns_dht_delegated_lookup.c
src/gns/test_gns_simple_delegated_lookup.c
src/gns/test_gns_simple_lookup.c
src/gns/test_gns_simple_lookup.conf

index 5008e04d849fd2ae067391dbd92fc4a0c3ac26ac..46375314bc96970e376988e32ddd5069969a6310 100644 (file)
@@ -5,8 +5,7 @@ HOME = $SERVICEHOME
 CONFIG = $DEFAULTCONFIG
 BINARY = gnunet-service-gns
 UNIXPATH = /tmp/gnunet-service-gns.sock
-ZONEKEY_DIRECTORY = $SERVICEHOME/gns
-ZONEKEY = $ZONEKEY_DIRECTORY/zonekey.zkey
+ZONEKEY = $SERVICEHOME/gns/zonekey.zkey
 HIJACK_DNS = NO
 
 [fcfsd]
index 53b8feef7d726a72126ac7dac8406f907b0934c0..bd77f378e2dcfe83d484ef7179924b3f1d310915 100644 (file)
@@ -369,6 +369,8 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe,
               "Received shortened reply `%s' from GNS service\n",
               short_name);
   
+  GNUNET_CLIENT_receive (h->client, &process_message, h,
+                         GNUNET_TIME_UNIT_FOREVER_REL);
   qe->shorten_proc(qe->proc_cls, short_name);
 
 }
@@ -404,6 +406,8 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe,
               "Received GET_AUTH reply `%s' from GNS service\n",
               auth_name);
   
+  GNUNET_CLIENT_receive (h->client, &process_message, h,
+                         GNUNET_TIME_UNIT_FOREVER_REL);
   qe->auth_proc(qe->proc_cls, auth_name);
 
 }
@@ -444,6 +448,8 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe,
               "Received lookup reply from GNS service (count=%d)\n",
               ntohl(msg->rd_count));
   
+  GNUNET_CLIENT_receive (h->client, &process_message, h,
+                         GNUNET_TIME_UNIT_FOREVER_REL);
   qe->lookup_proc(qe->proc_cls, rd_count, rd);
 }
 
@@ -553,8 +559,6 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
       process_get_auth_reply(qe, get_auth_msg);
   }
 
-  GNUNET_CLIENT_receive (handle->client, &process_message, handle,
-                         GNUNET_TIME_UNIT_FOREVER_REL);
 
   if (GNUNET_YES == handle->reconnect)
     force_reconnect (handle);
@@ -575,9 +579,11 @@ GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
   struct GNUNET_GNS_Handle *handle;
 
   handle = GNUNET_malloc (sizeof (struct GNUNET_GNS_Handle));
+  handle->reconnect = GNUNET_NO;
   handle->cfg = cfg;
   reconnect (handle);
   //handle->reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect_task, handle);
+  handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
   handle->r_id = 0;
   handle->in_receive = GNUNET_NO;
   return handle;
@@ -598,7 +604,7 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *h)
     GNUNET_SCHEDULER_cancel (h->reconnect_task);
     h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
   }
-  GNUNET_free(h);
+  //GNUNET_free(h);
   /* disco from GNS */
 }
 
index 0d33fad812bdea85995fe6ff6a69a290bfb43610..2f64a637db8de6e98592cf66693c2b542ae13917 100644 (file)
@@ -652,7 +652,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
 {
   
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initializing GNS\n");
-
+  
   char* keyfile;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
 
@@ -662,15 +662,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
     {&handle_get_authority, NULL, GNUNET_MESSAGE_TYPE_GNS_GET_AUTH, 0}
   };
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "gns",
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (c, "gns",
                                              "ZONEKEY", &keyfile))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "No private key for root zone specified%s!\n", keyfile);
+                "No private key for root zone specified!\n");
     GNUNET_SCHEDULER_shutdown(0);
     return;
   }
 
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "Using keyfile %s for root zone.\n", keyfile);
+
   zone_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
   GNUNET_CRYPTO_rsa_key_get_public (zone_key, &pkey);
 
index 1fa87c90512f5003602bd675e392c3417950e2d6..4f3cd09a275ea24637baf8889ef66cc9aa8247f8 100644 (file)
@@ -161,7 +161,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
  * tries to look up the dns record for TEST_DOMAIN
  */
 static void
-commence_testing (void *cls, int32_t success, const char *emsg)
+commence_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES);
 
@@ -235,7 +235,7 @@ put_dht(void *cls, int32_t success, const char *emsg)
   nrb->public_key = bob_pkey;
   nrb->rd_count = htonl(1);
   memset(&nrb[1], 0, strlen(TEST_RECORD_NAME) + 1);
-  strcpy(&nrb[1], TEST_RECORD_NAME);
+  strcpy((char*)&nrb[1], TEST_RECORD_NAME);
   nrb_data = (char*)&nrb[1];
   nrb_data += strlen(TEST_RECORD_NAME) + 1;
 
@@ -302,7 +302,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
     return;
   }
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns",
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
                                                           "ZONEKEY",
                                                           &alice_keyfile))
   {
index b80f2bbf0c4c14509c66f7aac461988c2d5f33ed..49e30fa5b23d70b482e264f25cb005835766ae16 100644 (file)
@@ -218,7 +218,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
     return;
   }
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns",
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
                                                           "ZONEKEY",
                                                           &alice_keyfile))
   {
index f7443d1fd1e480d12236ed5ffeccefe433f1f2a2..76f7efececb30ba0d6c1aa7c1076c1ce65ffb2a4 100644 (file)
@@ -217,7 +217,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
     return;
   }
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns",
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
                                                           "ZONEKEY",
                                                           &alice_keyfile))
   {
index d60828460af080072514b1e3a7f8fa83410e8bd8..0ce47ccec7de97cd0b886f0853385ec6d7e141e0 100644 (file)
@@ -74,7 +74,7 @@ DNS_EXIT = 8.8.8.8
 #PREFIX = valgrind -v --leak-check=full --track-origins=yes 
 AUTOSTART = YES
 BINARY = gnunet-service-gns
-ZONEKEY = zonekey
+ZONEKEY =  $SERVICEHOME/gns/zonekey.zkey
 HIJACK_DNS = NO
 UNIXPATH = /tmp/gnunet-service-gns.sock
 HOME = $SERVICEHOME