From: Martin Schanzenbach Date: Thu, 15 Mar 2012 11:25:16 +0000 (+0000) Subject: -fix client receive, zonefile loading X-Git-Tag: initial-import-from-subversion-38251~14252 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0bc07e291340de87cd9fe6bca0a6e62720017cb5;p=oweals%2Fgnunet.git -fix client receive, zonefile loading --- 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 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] 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, "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 */ } 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, { 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); 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, * 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)) { 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, return; } - if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns", + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "ZONEKEY", &alice_keyfile)) { 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, return; } - if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns", + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", "ZONEKEY", &alice_keyfile)) { 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 #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