gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13177 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r13177 - gnunet/src/dht
Date: Wed, 6 Oct 2010 11:55:35 +0200

Author: nevans
Date: 2010-10-06 11:55:35 +0200 (Wed, 06 Oct 2010)
New Revision: 13177

Modified:
   gnunet/src/dht/gnunet-service-dht.c
   gnunet/src/dht/test_dht_tools.sh
Log:
test case fix, dht bugfix

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-10-06 09:47:05 UTC (rev 13176)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-10-06 09:55:35 UTC (rev 13177)
@@ -2505,11 +2505,18 @@
 
   recent_hash = GNUNET_malloc(sizeof(GNUNET_HashCode));
   memcpy(recent_hash, &message_context->key, sizeof(GNUNET_HashCode));
-  GNUNET_CONTAINER_multihashmap_put (recent_find_peer_requests, 
+  if (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_put 
(recent_find_peer_requests,
                                     &message_context->key, NULL, 
-                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
-  GNUNET_SCHEDULER_add_delayed (sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30), 
-                               &remove_recent_find_peer, recent_hash);
+                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
+    {
+      /* Only add a task if there wasn't one for this key already! */
+      GNUNET_SCHEDULER_add_delayed (sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30),
+                                    &remove_recent_find_peer, recent_hash);
+    }
+  else
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received duplicate find peer 
request too soon!\n");
+    }
 
   /* Simplistic find_peer functionality, always return our hello */
   hello_size = ntohs(my_hello->size);

Modified: gnunet/src/dht/test_dht_tools.sh
===================================================================
--- gnunet/src/dht/test_dht_tools.sh    2010-10-06 09:47:05 UTC (rev 13176)
+++ gnunet/src/dht/test_dht_tools.sh    2010-10-06 09:55:35 UTC (rev 13177)
@@ -42,7 +42,7 @@
 sleep 1
 
 echo -n "TEST: Testing put..."
-if ! $putexe -k testkey -d testdata -T 8 > $out ; then
+if ! $putexe -k testkey -d testdata -t 8 > $out ; then
   echo "FAIL: error running $putexe"
   echo "Command output was:"
   cat $out
@@ -53,10 +53,10 @@
 sleep 1
 
 echo -n "TEST: Testing get..."
-echo "Result 0, type 0:" > $checkout
+echo "Result 0, type 8:" > $checkout
 echo "testdata" >> $checkout
 
-if ! $getexe -k testkey -T 8 > $out ; then
+if ! $getexe -k testkey -T 5 -t 8 > $out ; then
   echo "FAIL: error running $putexe"
   echo "Command output was:"
   cat $out




reply via email to

[Prev in Thread] Current Thread [Next in Thread]