aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-03-15 11:25:16 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-03-15 11:25:16 +0000
commit0bc07e291340de87cd9fe6bca0a6e62720017cb5 (patch)
treed1e0553f479c7a156a731443c466170ac3e42569
parent06ab78ee651fdda7cf37a7c012445bb087060a05 (diff)
downloadgnunet-0bc07e291340de87cd9fe6bca0a6e62720017cb5.tar.gz
gnunet-0bc07e291340de87cd9fe6bca0a6e62720017cb5.zip
-fix client receive, zonefile loading
-rw-r--r--src/gns/gns.conf.in3
-rw-r--r--src/gns/gns_api.c12
-rw-r--r--src/gns/gnunet-service-gns.c9
-rw-r--r--src/gns/test_gns_dht_delegated_lookup.c6
-rw-r--r--src/gns/test_gns_simple_delegated_lookup.c2
-rw-r--r--src/gns/test_gns_simple_lookup.c2
-rw-r--r--src/gns/test_gns_simple_lookup.conf2
7 files changed, 22 insertions, 14 deletions
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 5008e04d8..46375314b 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -5,8 +5,7 @@ HOME = $SERVICEHOME
5CONFIG = $DEFAULTCONFIG 5CONFIG = $DEFAULTCONFIG
6BINARY = gnunet-service-gns 6BINARY = gnunet-service-gns
7UNIXPATH = /tmp/gnunet-service-gns.sock 7UNIXPATH = /tmp/gnunet-service-gns.sock
8ZONEKEY_DIRECTORY = $SERVICEHOME/gns 8ZONEKEY = $SERVICEHOME/gns/zonekey.zkey
9ZONEKEY = $ZONEKEY_DIRECTORY/zonekey.zkey
10HIJACK_DNS = NO 9HIJACK_DNS = NO
11 10
12[fcfsd] 11[fcfsd]
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 53b8feef7..bd77f378e 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -369,6 +369,8 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe,
369 "Received shortened reply `%s' from GNS service\n", 369 "Received shortened reply `%s' from GNS service\n",
370 short_name); 370 short_name);
371 371
372 GNUNET_CLIENT_receive (h->client, &process_message, h,
373 GNUNET_TIME_UNIT_FOREVER_REL);
372 qe->shorten_proc(qe->proc_cls, short_name); 374 qe->shorten_proc(qe->proc_cls, short_name);
373 375
374} 376}
@@ -404,6 +406,8 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe,
404 "Received GET_AUTH reply `%s' from GNS service\n", 406 "Received GET_AUTH reply `%s' from GNS service\n",
405 auth_name); 407 auth_name);
406 408
409 GNUNET_CLIENT_receive (h->client, &process_message, h,
410 GNUNET_TIME_UNIT_FOREVER_REL);
407 qe->auth_proc(qe->proc_cls, auth_name); 411 qe->auth_proc(qe->proc_cls, auth_name);
408 412
409} 413}
@@ -444,6 +448,8 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe,
444 "Received lookup reply from GNS service (count=%d)\n", 448 "Received lookup reply from GNS service (count=%d)\n",
445 ntohl(msg->rd_count)); 449 ntohl(msg->rd_count));
446 450
451 GNUNET_CLIENT_receive (h->client, &process_message, h,
452 GNUNET_TIME_UNIT_FOREVER_REL);
447 qe->lookup_proc(qe->proc_cls, rd_count, rd); 453 qe->lookup_proc(qe->proc_cls, rd_count, rd);
448} 454}
449 455
@@ -553,8 +559,6 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
553 process_get_auth_reply(qe, get_auth_msg); 559 process_get_auth_reply(qe, get_auth_msg);
554 } 560 }
555 561
556 GNUNET_CLIENT_receive (handle->client, &process_message, handle,
557 GNUNET_TIME_UNIT_FOREVER_REL);
558 562
559 if (GNUNET_YES == handle->reconnect) 563 if (GNUNET_YES == handle->reconnect)
560 force_reconnect (handle); 564 force_reconnect (handle);
@@ -575,9 +579,11 @@ GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
575 struct GNUNET_GNS_Handle *handle; 579 struct GNUNET_GNS_Handle *handle;
576 580
577 handle = GNUNET_malloc (sizeof (struct GNUNET_GNS_Handle)); 581 handle = GNUNET_malloc (sizeof (struct GNUNET_GNS_Handle));
582 handle->reconnect = GNUNET_NO;
578 handle->cfg = cfg; 583 handle->cfg = cfg;
579 reconnect (handle); 584 reconnect (handle);
580 //handle->reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect_task, handle); 585 //handle->reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect_task, handle);
586 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
581 handle->r_id = 0; 587 handle->r_id = 0;
582 handle->in_receive = GNUNET_NO; 588 handle->in_receive = GNUNET_NO;
583 return handle; 589 return handle;
@@ -598,7 +604,7 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *h)
598 GNUNET_SCHEDULER_cancel (h->reconnect_task); 604 GNUNET_SCHEDULER_cancel (h->reconnect_task);
599 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 605 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
600 } 606 }
601 GNUNET_free(h); 607 //GNUNET_free(h);
602 /* disco from GNS */ 608 /* disco from GNS */
603} 609}
604 610
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 0d33fad81..2f64a637d 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -652,7 +652,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
652{ 652{
653 653
654 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initializing GNS\n"); 654 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initializing GNS\n");
655 655
656 char* keyfile; 656 char* keyfile;
657 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; 657 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
658 658
@@ -662,15 +662,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
662 {&handle_get_authority, NULL, GNUNET_MESSAGE_TYPE_GNS_GET_AUTH, 0} 662 {&handle_get_authority, NULL, GNUNET_MESSAGE_TYPE_GNS_GET_AUTH, 0}
663 }; 663 };
664 664
665 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "gns", 665 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (c, "gns",
666 "ZONEKEY", &keyfile)) 666 "ZONEKEY", &keyfile))
667 { 667 {
668 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 668 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
669 "No private key for root zone specified%s!\n", keyfile); 669 "No private key for root zone specified!\n");
670 GNUNET_SCHEDULER_shutdown(0); 670 GNUNET_SCHEDULER_shutdown(0);
671 return; 671 return;
672 } 672 }
673 673
674 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
675 "Using keyfile %s for root zone.\n", keyfile);
676
674 zone_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); 677 zone_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
675 GNUNET_CRYPTO_rsa_key_get_public (zone_key, &pkey); 678 GNUNET_CRYPTO_rsa_key_get_public (zone_key, &pkey);
676 679
diff --git a/src/gns/test_gns_dht_delegated_lookup.c b/src/gns/test_gns_dht_delegated_lookup.c
index 1fa87c905..4f3cd09a2 100644
--- a/src/gns/test_gns_dht_delegated_lookup.c
+++ b/src/gns/test_gns_dht_delegated_lookup.c
@@ -161,7 +161,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
161 * tries to look up the dns record for TEST_DOMAIN 161 * tries to look up the dns record for TEST_DOMAIN
162 */ 162 */
163static void 163static void
164commence_testing (void *cls, int32_t success, const char *emsg) 164commence_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
165{ 165{
166 GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES); 166 GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES);
167 167
@@ -235,7 +235,7 @@ put_dht(void *cls, int32_t success, const char *emsg)
235 nrb->public_key = bob_pkey; 235 nrb->public_key = bob_pkey;
236 nrb->rd_count = htonl(1); 236 nrb->rd_count = htonl(1);
237 memset(&nrb[1], 0, strlen(TEST_RECORD_NAME) + 1); 237 memset(&nrb[1], 0, strlen(TEST_RECORD_NAME) + 1);
238 strcpy(&nrb[1], TEST_RECORD_NAME); 238 strcpy((char*)&nrb[1], TEST_RECORD_NAME);
239 nrb_data = (char*)&nrb[1]; 239 nrb_data = (char*)&nrb[1];
240 nrb_data += strlen(TEST_RECORD_NAME) + 1; 240 nrb_data += strlen(TEST_RECORD_NAME) + 1;
241 241
@@ -302,7 +302,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
302 return; 302 return;
303 } 303 }
304 304
305 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns", 305 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
306 "ZONEKEY", 306 "ZONEKEY",
307 &alice_keyfile)) 307 &alice_keyfile))
308 { 308 {
diff --git a/src/gns/test_gns_simple_delegated_lookup.c b/src/gns/test_gns_simple_delegated_lookup.c
index b80f2bbf0..49e30fa5b 100644
--- a/src/gns/test_gns_simple_delegated_lookup.c
+++ b/src/gns/test_gns_simple_delegated_lookup.c
@@ -218,7 +218,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
218 return; 218 return;
219 } 219 }
220 220
221 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns", 221 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
222 "ZONEKEY", 222 "ZONEKEY",
223 &alice_keyfile)) 223 &alice_keyfile))
224 { 224 {
diff --git a/src/gns/test_gns_simple_lookup.c b/src/gns/test_gns_simple_lookup.c
index f7443d1fd..76f7efece 100644
--- a/src/gns/test_gns_simple_lookup.c
+++ b/src/gns/test_gns_simple_lookup.c
@@ -217,7 +217,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
217 return; 217 return;
218 } 218 }
219 219
220 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns", 220 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
221 "ZONEKEY", 221 "ZONEKEY",
222 &alice_keyfile)) 222 &alice_keyfile))
223 { 223 {
diff --git a/src/gns/test_gns_simple_lookup.conf b/src/gns/test_gns_simple_lookup.conf
index d60828460..0ce47ccec 100644
--- a/src/gns/test_gns_simple_lookup.conf
+++ b/src/gns/test_gns_simple_lookup.conf
@@ -74,7 +74,7 @@ DNS_EXIT = 8.8.8.8
74#PREFIX = valgrind -v --leak-check=full --track-origins=yes 74#PREFIX = valgrind -v --leak-check=full --track-origins=yes
75AUTOSTART = YES 75AUTOSTART = YES
76BINARY = gnunet-service-gns 76BINARY = gnunet-service-gns
77ZONEKEY = zonekey 77ZONEKEY = $SERVICEHOME/gns/zonekey.zkey
78HIJACK_DNS = NO 78HIJACK_DNS = NO
79UNIXPATH = /tmp/gnunet-service-gns.sock 79UNIXPATH = /tmp/gnunet-service-gns.sock
80HOME = $SERVICEHOME 80HOME = $SERVICEHOME