diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-10-06 09:55:35 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-10-06 09:55:35 +0000 |
commit | 7671f5631189a466fe35ebaeeffb8312ab696794 (patch) | |
tree | 2c2dbcfe10fd083778f2831f60ea47a7b7f244b2 /src | |
parent | a66550732703fa7e88bc86b042e73c0add3e91a0 (diff) | |
download | gnunet-7671f5631189a466fe35ebaeeffb8312ab696794.tar.gz gnunet-7671f5631189a466fe35ebaeeffb8312ab696794.zip |
test case fix, dht bugfix
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 15 | ||||
-rwxr-xr-x | src/dht/test_dht_tools.sh | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 8dbb11525..d722f3335 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -2505,11 +2505,18 @@ handle_dht_find_peer (void *cls, | |||
2505 | 2505 | ||
2506 | recent_hash = GNUNET_malloc(sizeof(GNUNET_HashCode)); | 2506 | recent_hash = GNUNET_malloc(sizeof(GNUNET_HashCode)); |
2507 | memcpy(recent_hash, &message_context->key, sizeof(GNUNET_HashCode)); | 2507 | memcpy(recent_hash, &message_context->key, sizeof(GNUNET_HashCode)); |
2508 | GNUNET_CONTAINER_multihashmap_put (recent_find_peer_requests, | 2508 | if (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_put (recent_find_peer_requests, |
2509 | &message_context->key, NULL, | 2509 | &message_context->key, NULL, |
2510 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 2510 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
2511 | GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30), | 2511 | { |
2512 | &remove_recent_find_peer, recent_hash); | 2512 | /* Only add a task if there wasn't one for this key already! */ |
2513 | GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30), | ||
2514 | &remove_recent_find_peer, recent_hash); | ||
2515 | } | ||
2516 | else | ||
2517 | { | ||
2518 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received duplicate find peer request too soon!\n"); | ||
2519 | } | ||
2513 | 2520 | ||
2514 | /* Simplistic find_peer functionality, always return our hello */ | 2521 | /* Simplistic find_peer functionality, always return our hello */ |
2515 | hello_size = ntohs(my_hello->size); | 2522 | hello_size = ntohs(my_hello->size); |
diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh index b22084ebb..68c0613a4 100755 --- a/src/dht/test_dht_tools.sh +++ b/src/dht/test_dht_tools.sh | |||
@@ -42,7 +42,7 @@ echo "PASS" | |||
42 | sleep 1 | 42 | sleep 1 |
43 | 43 | ||
44 | echo -n "TEST: Testing put..." | 44 | echo -n "TEST: Testing put..." |
45 | if ! $putexe -k testkey -d testdata -T 8 > $out ; then | 45 | if ! $putexe -k testkey -d testdata -t 8 > $out ; then |
46 | echo "FAIL: error running $putexe" | 46 | echo "FAIL: error running $putexe" |
47 | echo "Command output was:" | 47 | echo "Command output was:" |
48 | cat $out | 48 | cat $out |
@@ -53,10 +53,10 @@ echo "PASS" | |||
53 | sleep 1 | 53 | sleep 1 |
54 | 54 | ||
55 | echo -n "TEST: Testing get..." | 55 | echo -n "TEST: Testing get..." |
56 | echo "Result 0, type 0:" > $checkout | 56 | echo "Result 0, type 8:" > $checkout |
57 | echo "testdata" >> $checkout | 57 | echo "testdata" >> $checkout |
58 | 58 | ||
59 | if ! $getexe -k testkey -T 8 > $out ; then | 59 | if ! $getexe -k testkey -T 5 -t 8 > $out ; then |
60 | echo "FAIL: error running $putexe" | 60 | echo "FAIL: error running $putexe" |
61 | echo "Command output was:" | 61 | echo "Command output was:" |
62 | cat $out | 62 | cat $out |