diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-23 13:02:57 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-23 13:02:57 +0000 |
commit | 68388f7bc0e15df6cb3b9e2be681b81fd3233073 (patch) | |
tree | a6743f6cfe3348ac5e38262cda817bae632c2051 /src/gns | |
parent | a7566b7ba06f63f60d3ac9b69f965211037ebc36 (diff) | |
download | gnunet-68388f7bc0e15df6cb3b9e2be681b81fd3233073.tar.gz gnunet-68388f7bc0e15df6cb3b9e2be681b81fd3233073.zip |
-fix
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 26 | ||||
-rw-r--r-- | src/gns/test_gns_pseu_shorten.c | 4 | ||||
-rw-r--r-- | src/gns/test_gns_simple_lookup.conf | 5 |
3 files changed, 22 insertions, 13 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 4674cfd24..b3dd5d2c7 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -325,8 +325,8 @@ process_zone_to_name_discover(void *cls, | |||
325 | "starting dht lookup for %s with key: %s\n", | 325 | "starting dht lookup for %s with key: %s\n", |
326 | "+", (char*)&lookup_key_string); | 326 | "+", (char*)&lookup_key_string); |
327 | 327 | ||
328 | //gph->timeout = GNUNET_SCHEDULER_add_delayed(DHT_LOOKUP_TIMEOUT, | 328 | gph->timeout = GNUNET_SCHEDULER_add_delayed(DHT_LOOKUP_TIMEOUT, |
329 | // &handle_auth_discovery_timeout, gph); | 329 | &handle_auth_discovery_timeout, gph); |
330 | 330 | ||
331 | xquery = htonl(GNUNET_GNS_RECORD_PSEU); | 331 | xquery = htonl(GNUNET_GNS_RECORD_PSEU); |
332 | 332 | ||
@@ -814,7 +814,10 @@ process_record_result_ns(void* cls, | |||
814 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); | 814 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); |
815 | 815 | ||
816 | if (rh->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 816 | if (rh->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
817 | { | ||
817 | GNUNET_SCHEDULER_cancel(rh->timeout_task); | 818 | GNUNET_SCHEDULER_cancel(rh->timeout_task); |
819 | rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; | ||
820 | } | ||
818 | 821 | ||
819 | rh->status = 0; | 822 | rh->status = 0; |
820 | 823 | ||
@@ -986,6 +989,9 @@ dht_authority_lookup_timeout(void *cls, | |||
986 | /* Prototype */ | 989 | /* Prototype */ |
987 | static void resolve_delegation_dht(struct ResolverHandle *rh); | 990 | static void resolve_delegation_dht(struct ResolverHandle *rh); |
988 | 991 | ||
992 | /* Prototype */ | ||
993 | static void resolve_delegation_ns(struct ResolverHandle *rh); | ||
994 | |||
989 | /** | 995 | /** |
990 | * Function called when we get a result from the dht | 996 | * Function called when we get a result from the dht |
991 | * for our query. Recursively tries to resolve authorities | 997 | * for our query. Recursively tries to resolve authorities |
@@ -1132,7 +1138,7 @@ process_delegation_result_dht(void* cls, | |||
1132 | if (strcmp(rh->name, "") == 0) | 1138 | if (strcmp(rh->name, "") == 0) |
1133 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1139 | rh->proc(rh->proc_cls, rh, 0, NULL); |
1134 | else | 1140 | else |
1135 | resolve_delegation_dht(rh); | 1141 | resolve_delegation_ns(rh); |
1136 | return; | 1142 | return; |
1137 | } | 1143 | } |
1138 | 1144 | ||
@@ -1203,12 +1209,15 @@ finish_lookup(struct ResolverHandle *rh, | |||
1203 | char* pos; | 1209 | char* pos; |
1204 | unsigned int offset; | 1210 | unsigned int offset; |
1205 | 1211 | ||
1212 | if (rh->timeout_task != GNUNET_SCHEDULER_NO_TASK) | ||
1213 | GNUNET_SCHEDULER_cancel(rh->timeout_task); | ||
1214 | |||
1206 | if (rd_count > 0) | 1215 | if (rd_count > 0) |
1207 | memcpy(p_rd, rd, rd_count*sizeof(struct GNUNET_NAMESTORE_RecordData)); | 1216 | memcpy(p_rd, rd, rd_count*sizeof(struct GNUNET_NAMESTORE_RecordData)); |
1208 | 1217 | ||
1209 | for (i = 0; i < rd_count; i++) | 1218 | for (i = 0; i < rd_count; i++) |
1210 | { | 1219 | { |
1211 | 1220 | ||
1212 | if (rd[i].record_type != GNUNET_GNS_RECORD_TYPE_NS && | 1221 | if (rd[i].record_type != GNUNET_GNS_RECORD_TYPE_NS && |
1213 | rd[i].record_type != GNUNET_GNS_RECORD_TYPE_CNAME && | 1222 | rd[i].record_type != GNUNET_GNS_RECORD_TYPE_CNAME && |
1214 | rd[i].record_type != GNUNET_GNS_RECORD_MX && | 1223 | rd[i].record_type != GNUNET_GNS_RECORD_MX && |
@@ -1254,8 +1263,8 @@ finish_lookup(struct ResolverHandle *rh, | |||
1254 | expand_plus(&pos, (char*)rd[i].data+offset, repl_string); | 1263 | expand_plus(&pos, (char*)rd[i].data+offset, repl_string); |
1255 | offset += strlen(new_soa_data+offset)+1; | 1264 | offset += strlen(new_soa_data+offset)+1; |
1256 | /* cpy the 4 numbers serial refresh retry and expire */ | 1265 | /* cpy the 4 numbers serial refresh retry and expire */ |
1257 | memcpy(new_soa_data+offset, (char*)rd[i].data+offset, sizeof(uint32_t)*4); | 1266 | memcpy(new_soa_data+offset, (char*)rd[i].data+offset, sizeof(uint32_t)*5); |
1258 | offset += sizeof(uint32_t)*4; | 1267 | offset += sizeof(uint32_t)*5; |
1259 | p_rd[i].data_size = offset; | 1268 | p_rd[i].data_size = offset; |
1260 | p_rd[i].data = new_soa_data; | 1269 | p_rd[i].data = new_soa_data; |
1261 | } | 1270 | } |
@@ -1585,6 +1594,7 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1585 | { | 1594 | { |
1586 | if ((rlh->record_type == GNUNET_GNS_RECORD_PKEY)) | 1595 | if ((rlh->record_type == GNUNET_GNS_RECORD_PKEY)) |
1587 | { | 1596 | { |
1597 | GNUNET_assert(rd_count == 1); | ||
1588 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1598 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1589 | "Resolved queried PKEY in NS.\n"); | 1599 | "Resolved queried PKEY in NS.\n"); |
1590 | finish_lookup(rh, rlh, rd_count, rd); | 1600 | finish_lookup(rh, rlh, rd_count, rd); |
@@ -1635,8 +1645,6 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1635 | resolve_delegation_dht(rh); | 1645 | resolve_delegation_dht(rh); |
1636 | } | 1646 | } |
1637 | 1647 | ||
1638 | /* Prototype */ | ||
1639 | static void resolve_delegation_ns(struct ResolverHandle *rh); | ||
1640 | 1648 | ||
1641 | 1649 | ||
1642 | /** | 1650 | /** |
@@ -1773,7 +1781,7 @@ process_delegation_result_ns(void* cls, | |||
1773 | * else resolve again with new authority | 1781 | * else resolve again with new authority |
1774 | */ | 1782 | */ |
1775 | if (strcmp(rh->name, "") == 0) | 1783 | if (strcmp(rh->name, "") == 0) |
1776 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1784 | rh->proc(rh->proc_cls, rh, rd_count, rd); |
1777 | else | 1785 | else |
1778 | resolve_delegation_ns(rh); | 1786 | resolve_delegation_ns(rh); |
1779 | return; | 1787 | return; |
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c index ce2511f32..2d5dfd332 100644 --- a/src/gns/test_gns_pseu_shorten.c +++ b/src/gns/test_gns_pseu_shorten.c | |||
@@ -576,7 +576,7 @@ check () | |||
576 | int ret; | 576 | int ret; |
577 | 577 | ||
578 | /* Arguments for GNUNET_PROGRAM_run */ | 578 | /* Arguments for GNUNET_PROGRAM_run */ |
579 | char *const argv[] = { "test-gns-dht-delegated-lookup", /* Name to give running binary */ | 579 | char *const argv[] = { "test-gns-pseu-shorten", /* Name to give running binary */ |
580 | "-c", | 580 | "-c", |
581 | "test_gns_simple_lookup.conf", /* Config file to use */ | 581 | "test_gns_simple_lookup.conf", /* Config file to use */ |
582 | #if VERBOSE | 582 | #if VERBOSE |
@@ -590,7 +590,7 @@ check () | |||
590 | /* Run the run function as a new program */ | 590 | /* Run the run function as a new program */ |
591 | ret = | 591 | ret = |
592 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 592 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
593 | "test-gns-dht-delegated-lookup", "nohelp", options, &run, | 593 | "test-gns-pseu-shorten", "nohelp", options, &run, |
594 | &ok); | 594 | &ok); |
595 | if (ret != GNUNET_OK) | 595 | if (ret != GNUNET_OK) |
596 | { | 596 | { |
diff --git a/src/gns/test_gns_simple_lookup.conf b/src/gns/test_gns_simple_lookup.conf index c2fede933..9cd5bcc67 100644 --- a/src/gns/test_gns_simple_lookup.conf +++ b/src/gns/test_gns_simple_lookup.conf | |||
@@ -81,9 +81,10 @@ HOME = $SERVICEHOME | |||
81 | CONFIG = $DEFAULTCONFIG | 81 | CONFIG = $DEFAULTCONFIG |
82 | AUTO_IMPORT_PKEY = YES | 82 | AUTO_IMPORT_PKEY = YES |
83 | MAX_PARALLEL_BACKGROUND_QUERIES = 10 | 83 | MAX_PARALLEL_BACKGROUND_QUERIES = 10 |
84 | DEFAULT_LOOKUP_TIMEOUT = 5 | 84 | DEFAULT_LOOKUP_TIMEOUT = 30 |
85 | 85 | ||
86 | [nse] | 86 | [nse] |
87 | AUTOSTART = NO | 87 | AUTOSTART = NO |
88 | 88 | ||
89 | 89 | [statistics] | |
90 | AUTOSTART = NO | ||