From: Martin Schanzenbach Date: Thu, 23 Feb 2012 17:09:02 +0000 (+0000) Subject: -process dht lookup X-Git-Tag: initial-import-from-subversion-38251~14691 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6a970be4b56545fe71f12f7abe0384cd81975245;p=oweals%2Fgnunet.git -process dht lookup --- diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 94824eb21..c37ad2a56 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -255,13 +255,76 @@ process_name_dht_result(void* cls, enum GNUNET_BLOCK_Type type, size_t size, const void *data) { + uint32_t num_records; + uint16_t namelen; + char* name = NULL; + struct GNUNET_CRYPTO_RsaSignature *signature; + int i; + char* pos; + GNUNET_HashCode zone, name_hash; + if (data == NULL) return; + + pos = (char*)data; + + num_records = ntohl(*pos); + struct GNUNET_NAMESTORE_RecordData rd[num_records]; + + pos += sizeof(uint32_t); + + for (i=0; irecord_type. Parse and put into namestore - * namestore zone hash is in query. * Check if record type and name match in query and reply * to dns! */ @@ -486,7 +549,6 @@ process_authoritative_result(void* cls, * FIXME * Lookup terminated and no results * -> DHT Phase unless data is recent - * if full_name == next_name and not anwered we cannot resolve */ GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Namestore lookup terminated. without results\n"); @@ -497,7 +559,7 @@ process_authoritative_result(void* cls, */ if (!GNUNET_CRYPTO_hash_cmp(&zone, &zone_hash)) { - //FIXME todo + //FIXME if very recent dht lookup -> cannot resolve resolve_name_dht(query, name); return; } @@ -506,6 +568,8 @@ process_authoritative_result(void* cls, * Our zone and no result? Cannot resolve TT * FIXME modify query to say NX */ + GNUNET_assert(query->answered == 0); + reply_to_dns(query); //answered should be 0 return; } @@ -518,7 +582,7 @@ process_authoritative_result(void* cls, * consult dht if necessary */ GNUNET_log(GNUNET_ERROR_TYPE_INFO, - "Processing additional result for %s from namestore\n", name); + "Processing additional result %s from namestore\n", name); int i; for (i=0; iname = (char*)query->original_name; }