gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13139 - gnunet/src/dht
Date: Sun, 3 Oct 2010 23:37:15 +0200

Author: grothoff
Date: 2010-10-03 23:37:15 +0200 (Sun, 03 Oct 2010)
New Revision: 13139

Modified:
   gnunet/src/dht/dht_api.c
   gnunet/src/dht/dht_api_get_put.c
   gnunet/src/dht/gnunet-service-dht.c
   gnunet/src/dht/test_dht_api.c
   gnunet/src/dht/test_dht_api_data.conf
Log:
making test_dht_api work

Modified: gnunet/src/dht/dht_api.c
===================================================================
--- gnunet/src/dht/dht_api.c    2010-10-03 21:28:06 UTC (rev 13138)
+++ gnunet/src/dht/dht_api.c    2010-10-03 21:37:15 UTC (rev 13139)
@@ -231,6 +231,8 @@
                  _("Failed to connect to the DHT service!\n"));
       return GNUNET_NO;
     }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting to process replies from DHT\n");
   GNUNET_CLIENT_receive (handle->client,
                          &service_message_handler,
                          handle, 
@@ -373,6 +375,9 @@
   if (GNUNET_YES == head->free_on_send)
     GNUNET_free (head);
   process_pending_messages (handle);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Forwarded request of %u bytes to DHT service\n",
+             (unsigned int) tsize);
   return tsize;
 }
 
@@ -396,7 +401,11 @@
 
   uid = GNUNET_ntohll (dht_msg->unique_id);
   if (uid != rh->uid)
-    return GNUNET_YES;
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Reply UID did not match request UID\n");
+      return GNUNET_YES;
+    }
   enc_size = ntohs (dht_msg->header.size) - sizeof (struct 
GNUNET_DHT_RouteResultMessage);
   if (enc_size < sizeof (struct GNUNET_MessageHeader))
     {
@@ -409,6 +418,8 @@
       GNUNET_break (0);
       return GNUNET_NO;
     }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Processing reply.\n");
   rh->iter (rh->iter_cls, 
            &rh->key,
            enc_msg);
@@ -429,9 +440,14 @@
 {
   struct GNUNET_DHT_Handle *handle = cls;
   const struct GNUNET_DHT_RouteResultMessage *dht_msg;
-  
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "%s called\n",
+             __FUNCTION__);  
   if (msg == NULL)
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Error receiving data from DHT service, reconnecting\n");
       reconnect (handle);
       return;
     }
@@ -448,10 +464,16 @@
       return;
     }
   dht_msg = (const struct GNUNET_DHT_RouteResultMessage *) msg;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Comparing reply `%s' against %u pending requests.\n",
+             GNUNET_h2s (&dht_msg->key),
+             GNUNET_CONTAINER_multihashmap_size (handle->active_requests));
   GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests,
                                              &dht_msg->key,
                                              &process_reply,
                                              (void*) dht_msg);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Continuing to process replies from DHT\n");
   GNUNET_CLIENT_receive (handle->client,
                          &service_message_handler,
                          handle, GNUNET_TIME_UNIT_FOREVER_REL);
@@ -656,6 +678,9 @@
                               pending);
   pending->in_pending_queue = GNUNET_YES;
   process_pending_messages (handle);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "DHT route start request processed, returning %p\n",
+             route_handle);
   return route_handle;
 }
 
@@ -708,6 +733,8 @@
                                                       route_handle));
   GNUNET_free(route_handle->message);
   GNUNET_free(route_handle);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "DHT route stop request processed\n");
 }
 
 

Modified: gnunet/src/dht/dht_api_get_put.c
===================================================================
--- gnunet/src/dht/dht_api_get_put.c    2010-10-03 21:28:06 UTC (rev 13138)
+++ gnunet/src/dht/dht_api_get_put.c    2010-10-03 21:37:15 UTC (rev 13139)
@@ -75,7 +75,10 @@
   put_msg->type = htons (type);
   put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
   memcpy (&put_msg[1], data, size);
-
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting route for %u byte `%s' message\n",
+             (unsigned int) (sizeof (struct GNUNET_DHT_PutMessage) + size),
+             "PUT");
   GNUNET_break (NULL ==
                GNUNET_DHT_route_start (handle, 
                                        key, 
@@ -132,7 +135,10 @@
   size_t payload;
 
   if (ntohs (reply->type) != GNUNET_MESSAGE_TYPE_DHT_GET_RESULT)
-    return;
+    {
+      GNUNET_break (0);
+      return;
+    }
 
   GNUNET_assert (ntohs (reply->size) >=
                  sizeof (struct GNUNET_DHT_GetResultMessage));
@@ -194,6 +200,10 @@
   get_msg.header.type = htons (GNUNET_MESSAGE_TYPE_DHT_GET);
   get_msg.header.size = htons (sizeof (struct GNUNET_DHT_GetMessage));
   get_msg.type = htons (type);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting route for %u byte `%s' message\n",
+             (unsigned int) sizeof (struct GNUNET_DHT_GetMessage),
+             "GET");
   get_handle->route_handle =
     GNUNET_DHT_route_start (handle,
                            key, 

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-10-03 21:28:06 UTC (rev 13138)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-10-03 21:37:15 UTC (rev 13139)
@@ -48,6 +48,7 @@
 #define REAL_DISTANCE GNUNET_NO
 
 #define EXTRA_CHECKS GNUNET_NO
+
 /**
  * How many buckets will we allow total.
  */
@@ -1818,6 +1819,11 @@
       off += msize;
     }
   process_pending_messages (client);
+#if DEBUG_DHT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Transmitted %u bytes of replies to client\n",
+             (unsigned int) off);
+#endif
   return off;
 }
 
@@ -1853,7 +1859,8 @@
 static void
 send_reply_to_client (struct ClientList *client,
                       const struct GNUNET_MessageHeader *message,
-                      unsigned long long uid)
+                      unsigned long long uid,
+                     const GNUNET_HashCode *key)
 {
   struct GNUNET_DHT_RouteResultMessage *reply;
   struct PendingMessage *pending_message;
@@ -1877,6 +1884,7 @@
   reply->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_LOCAL_ROUTE_RESULT);
   reply->header.size = htons (tsize);
   reply->unique_id = GNUNET_htonll (uid);
+  reply->key = *key;
   memcpy (&reply[1], message, msize);
 
   add_pending_message (client, pending_message);
@@ -1969,7 +1977,7 @@
 #if DEBUG_DHT
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "`%s:%s': Have no record of response key %s uid %llu\n", 
my_short_id,
-                "DHT", GNUNET_h2s (message_context->key), 
message_context->unique_id);
+                "DHT", GNUNET_h2s (&message_context->key), 
message_context->unique_id);
 #endif
 #if DEBUG_DHT_ROUTING
       if ((debug_routes_extended) && (dhtlog_handle != NULL))
@@ -2014,7 +2022,7 @@
 #if DEBUG_DHT
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "`%s:%s': Sending response key %s uid %llu to client\n", 
my_short_id,
-                      "DHT", GNUNET_h2s (message_context->key), 
message_context->unique_id);
+                      "DHT", GNUNET_h2s (&message_context->key), 
message_context->unique_id);
 #endif
 #if DEBUG_DHT_ROUTING
           if ((debug_routes_extended) && (dhtlog_handle != NULL))
@@ -2029,7 +2037,9 @@
           if (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DHT_GET_RESULT)
             increment_stats(STAT_GET_REPLY);
 
-          send_reply_to_client(pos->client, msg, message_context->unique_id);
+          send_reply_to_client(pos->client, msg, 
+                              message_context->unique_id,
+                              &message_context->key);
         }
       else /* Send to peer */
         {
@@ -2048,7 +2058,7 @@
 #if DEBUG_DHT
               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                           "`%s:%s': Forwarding response key %s uid %llu to 
peer %s\n", my_short_id,
-                          "DHT", GNUNET_h2s (message_context->key), 
message_context->unique_id, GNUNET_i2s(&peer_info->id));
+                          "DHT", GNUNET_h2s (&message_context->key), 
message_context->unique_id, GNUNET_i2s(&peer_info->id));
 #endif
 #if DEBUG_DHT_ROUTING
               if ((debug_routes_extended) && (dhtlog_handle != NULL))
@@ -2067,7 +2077,7 @@
 #if DEBUG_DHT
               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                           "`%s:%s': NOT Forwarding response (bloom match) key 
%s uid %llu to peer %s\n", my_short_id,
-                          "DHT", GNUNET_h2s (message_context->key), 
message_context->unique_id, GNUNET_i2s(&peer_info->id));
+                          "DHT", GNUNET_h2s (&message_context->key), 
message_context->unique_id, GNUNET_i2s(&peer_info->id));
 #endif
             }
         }
@@ -2159,7 +2169,7 @@
 #if DEBUG_DHT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "`%s:%s': Received `%s' request, message type %u, key %s, uid 
%llu\n", my_short_id,
-              "DHT", "GET", get_type, GNUNET_h2s (message_context->key),
+              "DHT", "GET", get_type, GNUNET_h2s (&message_context->key),
               message_context->unique_id);
 #endif
   increment_stats(STAT_GETS);
@@ -2279,7 +2289,7 @@
 #if DEBUG_DHT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "`%s:%s': Received `%s' request from client, key %s (msg size 
%d, we expected %d)\n",
-              my_short_id, "DHT", "FIND PEER", GNUNET_h2s 
(message_context->key),
+              my_short_id, "DHT", "FIND PEER", GNUNET_h2s 
(&message_context->key),
               ntohs (find_msg->size),
               sizeof (struct GNUNET_MessageHeader));
 #endif
@@ -2422,7 +2432,7 @@
 #if DEBUG_DHT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "`%s:%s': Received `%s' request (inserting data!), message type 
%d, key %s, uid %llu\n",
-              my_short_id, "DHT", "PUT", put_type, GNUNET_h2s 
(message_context->key), message_context->unique_id);
+              my_short_id, "DHT", "PUT", put_type, GNUNET_h2s 
(&message_context->key), message_context->unique_id);
 #endif
 #if DEBUG_DHT_ROUTING
   if (message_context->hop_count == 0) /* Locally initiated request */
@@ -3219,7 +3229,7 @@
 #if DEBUG_DHT > 1
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "`%s:%s': Created new forward source info for %s uid 
%llu\n", my_short_id,
-                  "DHT", GNUNET_h2s (msg_ctx->key), msg_ctx->unique_id);
+                  "DHT", GNUNET_h2s (&msg_ctx->key), msg_ctx->unique_id);
 #endif
   return GNUNET_YES;
 }
@@ -3412,7 +3422,7 @@
           nearest_buf = GNUNET_strdup(GNUNET_i2s(&nearest->id));
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "`%s:%s': Forwarding request key %s uid %llu to peer %s 
(closest %s, bits %d, distance %u)\n", my_short_id,
-                      "DHT", GNUNET_h2s (message_context->key), 
message_context->unique_id, GNUNET_i2s(&selected->id), nearest_buf, 
GNUNET_CRYPTO_hash_matching_bits(&nearest->id.hashPubKey, 
message_context->key), distance(&nearest->id.hashPubKey, message_context->key));
+                      "DHT", GNUNET_h2s (&message_context->key), 
message_context->unique_id, GNUNET_i2s(&selected->id), nearest_buf, 
GNUNET_CRYPTO_hash_matching_bits(&nearest->id.hashPubKey, 
message_context->key), distance(&nearest->id.hashPubKey, message_context->key));
           GNUNET_free(nearest_buf);
 #endif
 #if DEBUG_DHT_ROUTING
@@ -3859,11 +3869,16 @@
   const struct GNUNET_DHT_RouteMessage *dht_msg = (const struct 
GNUNET_DHT_RouteMessage *) message;
   const struct GNUNET_MessageHeader *enc_msg;
   struct DHT_MessageContext message_context;
+
   enc_msg = (const struct GNUNET_MessageHeader *) &dht_msg[1];
 #if DEBUG_DHT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "`%s:%s': Received `%s' request from client, message type %d, 
key %s, uid %llu\n",
-              my_short_id, "DHT", "GENERIC", enc_type, GNUNET_h2s 
(&dht_msg->key),
+              my_short_id, 
+             "DHT",
+             "GENERIC",
+             ntohs (message->type), 
+             GNUNET_h2s (&dht_msg->key),
               GNUNET_ntohll (dht_msg->unique_id));
 #endif
 #if DEBUG_DHT_ROUTING
@@ -3928,7 +3943,8 @@
     if (malicious_getter != GNUNET_YES)
       GNUNET_SCHEDULER_add_now(sched, &malicious_get_task, NULL);
     malicious_getter = GNUNET_YES;
-    GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Initiating malicious GET 
behavior, frequency %d\n", my_short_id, "DHT", malicious_get_frequency);
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
+              "%s:%s Initiating malicious GET behavior, frequency %d\n", 
my_short_id, "DHT", malicious_get_frequency);
     break;
   case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT:
     if (ntohs(dht_control_msg->variable) > 0)
@@ -3938,7 +3954,8 @@
     if (malicious_putter != GNUNET_YES)
       GNUNET_SCHEDULER_add_now(sched, &malicious_put_task, NULL);
     malicious_putter = GNUNET_YES;
-    GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Initiating malicious PUT 
behavior, frequency %d\n", my_short_id, "DHT", malicious_put_frequency);
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+              "%s:%s Initiating malicious PUT behavior, frequency %d\n", 
my_short_id, "DHT", malicious_put_frequency);
     break;
   case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP:
 #if DEBUG_DHT_ROUTING
@@ -3946,10 +3963,15 @@
       dhtlog_handle->set_malicious(&my_identity);
 #endif
     malicious_dropper = GNUNET_YES;
-    GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Initiating malicious DROP 
behavior\n", my_short_id, "DHT");
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+              "%s:%s Initiating malicious DROP behavior\n", my_short_id, 
"DHT");
     break;
   default:
-    GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Unknown control command type 
`%d'!\n", ntohs(dht_control_msg->command));
+    GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 
+              "%s:%s Unknown control command type `%d'!\n", 
+              my_short_id, "DHT",
+              ntohs(dht_control_msg->command));
+    break;
   }
 
   GNUNET_SERVER_receive_done (client, GNUNET_OK);

Modified: gnunet/src/dht/test_dht_api.c
===================================================================
--- gnunet/src/dht/test_dht_api.c       2010-10-03 21:28:06 UTC (rev 13138)
+++ gnunet/src/dht/test_dht_api.c       2010-10-03 21:37:15 UTC (rev 13139)
@@ -34,7 +34,7 @@
 #include "gnunet_dht_service.h"
 #include "gnunet_hello_lib.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define VERBOSE_ARM GNUNET_NO
 
@@ -109,25 +109,12 @@
 static void
 end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  /* do work here */
-  sleep(2);
   GNUNET_SCHEDULER_cancel (sched, die_task);
-
-  GNUNET_DHT_disconnect (p1.dht_handle);
   die_task = GNUNET_SCHEDULER_NO_TASK;
-
-  if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "DHT disconnected, returning FAIL!\n");
-      ok = 365;
-    }
-  else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "DHT disconnected, returning success!\n");
-      ok = 0;
-    }
+  GNUNET_DHT_disconnect (p1.dht_handle);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "DHT disconnected, returning success!\n");
+  ok = 0;
 }
 
 static void
@@ -150,17 +137,18 @@
   fprintf (stderr, "Ending on an unhappy note.\n");
 #endif
 
-  if ((retry_context.peer_ctx != NULL) && 
(retry_context.peer_ctx->find_peer_handle != NULL))
+  if ( (retry_context.peer_ctx != NULL) && 
+       (retry_context.peer_ctx->find_peer_handle != NULL) )
     GNUNET_DHT_find_peer_stop(retry_context.peer_ctx->find_peer_handle);
+  if ( (retry_context.peer_ctx != NULL) && 
+       (retry_context.peer_ctx->get_handle != NULL) )
+    GNUNET_DHT_get_stop (retry_context.peer_ctx->get_handle);
   if (retry_context.retry_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel(sched, retry_context.retry_task);
   GNUNET_DHT_disconnect (p1.dht_handle);
-
   ok = 1;
-  return;
 }
 
-#if HAVE_MALICIOUS
 
 /**
  * Signature of the main function of a task.
@@ -168,66 +156,6 @@
  * @param cls closure
  * @param tc context information (why was this task triggered now)
  */
-void test_set_peer_malicious_drop (void *cls, const struct 
GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct PeerContext *peer = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called 
test_set_peer_malicious_drop!\n");
-  if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
-
-  GNUNET_assert (peer->dht_handle != NULL);
-
-  GNUNET_DHT_set_malicious_dropper (peer->dht_handle, &end, &p1);
-}
-
-/**
- * Signature of the main function of a task.
- *
- * @param cls closure
- * @param tc context information (why was this task triggered now)
- */
-void test_set_peer_malicious_put (void *cls, const struct 
GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct PeerContext *peer = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called 
test_set_peer_malicious_put!\n");
-  if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
-
-  GNUNET_assert (peer->dht_handle != NULL);
-
-  GNUNET_DHT_set_malicious_putter (peer->dht_handle, 750, 
&test_set_peer_malicious_drop, &p1);
-}
-
-/**
- * Signature of the main function of a task.
- *
- * @param cls closure
- * @param tc context information (why was this task triggered now)
- */
-static void
-test_set_peer_malicious_get (void *cls, const struct 
GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct PeerContext *peer = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called 
test_set_peer_malicious_get!\n");
-  if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
-
-  GNUNET_assert (peer->dht_handle != NULL);
-
-  GNUNET_DHT_set_malicious_getter (peer->dht_handle, 1500, 
&test_set_peer_malicious_put, &p1);
-}
-#endif
-
-
-/**
- * Signature of the main function of a task.
- *
- * @param cls closure
- * @param tc context information (why was this task triggered now)
- */
 void
 test_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -235,20 +163,25 @@
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer_stop!\n");
   if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
+    {
+      GNUNET_break (0);
+      GNUNET_SCHEDULER_cancel (sched, die_task);
+      GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
+      return;
+    }
 
   GNUNET_assert (peer->dht_handle != NULL);
 
   GNUNET_DHT_find_peer_stop (peer->find_peer_handle);
 
 #if HAVE_MALICIOUS
-  GNUNET_SCHEDULER_add_now (sched,
-                           &test_set_peer_malicious_get, &p1);
-#else
-  GNUNET_SCHEDULER_add_delayed(sched, 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), 
-                              &end, &p1);
+  GNUNET_DHT_set_malicious_getter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS);
+  GNUNET_DHT_set_malicious_putter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS);
+  GNUNET_DHT_set_malicious_dropper (peer->dht_handle);
 #endif
-
+  GNUNET_SCHEDULER_add_delayed(sched, 
+                              
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), 
+                              &end, &p1);
 }
 
 
@@ -330,9 +263,13 @@
     }
 
   if (retry_ctx->peer_ctx->find_peer_handle == NULL)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, &p1);
-  else
-    retry_ctx->retry_task = GNUNET_SCHEDULER_add_delayed(sched, 
retry_ctx->next_timeout, &retry_find_peer_stop, retry_ctx);
+    {
+      GNUNET_break (0);
+      GNUNET_SCHEDULER_cancel (sched, die_task);
+      GNUNET_SCHEDULER_add_now (sched, &end_badly, &p1);
+      return;
+    }
+  retry_ctx->retry_task = GNUNET_SCHEDULER_add_delayed(sched, 
retry_ctx->next_timeout, &retry_find_peer_stop, retry_ctx);
 }
 
 /**
@@ -383,9 +320,13 @@
                                  &test_find_peer_processor, &retry_context);
 
   if (peer->find_peer_handle == NULL)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, &p1);
-  else
-    retry_context.retry_task = GNUNET_SCHEDULER_add_delayed(sched, 
retry_context.next_timeout, &retry_find_peer_stop, &retry_context);
+    {
+      GNUNET_break (0);
+      GNUNET_SCHEDULER_cancel (sched, die_task);
+      GNUNET_SCHEDULER_add_now (sched, &end_badly, &p1);
+      return;
+    }
+  retry_context.retry_task = GNUNET_SCHEDULER_add_delayed(sched, 
retry_context.next_timeout, &retry_find_peer_stop, &retry_context);
 }
 
 /**
@@ -401,7 +342,12 @@
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get_stop!\n");
   if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
+    {
+      GNUNET_break (0);
+      GNUNET_SCHEDULER_cancel (sched, die_task);
+      GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
+      return;
+    }
   GNUNET_assert (peer->dht_handle != NULL);
   GNUNET_DHT_get_stop (peer->get_handle);
   GNUNET_SCHEDULER_add_now(sched, 
@@ -445,7 +391,7 @@
   peer->get_handle =
     GNUNET_DHT_get_start (peer->dht_handle, 
                          TOTAL_TIMEOUT,
-                         49 /* fixme: use test type */, 
+                         GNUNET_BLOCK_TYPE_TEST,
                          &hash,
                          GNUNET_DHT_RO_NONE,
                          NULL, 0,
@@ -453,7 +399,12 @@
                           &test_get_iterator, NULL);
 
   if (peer->get_handle == NULL)
-    GNUNET_SCHEDULER_add_now (sched, &end_badly, &p1);
+    {
+      GNUNET_break (0);
+      GNUNET_SCHEDULER_cancel (sched, die_task);
+      GNUNET_SCHEDULER_add_now (sched, &end_badly, &p1);
+      return;
+    }
 }
 
 /**
@@ -479,7 +430,7 @@
 
   GNUNET_DHT_put (peer->dht_handle, &hash, 
                  GNUNET_DHT_RO_NONE,
-                 49 /* fixme: use test type */,
+                 GNUNET_BLOCK_TYPE_TEST,
                  data_size, data,
                   GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT),
                  TOTAL_TIMEOUT,

Modified: gnunet/src/dht/test_dht_api_data.conf
===================================================================
--- gnunet/src/dht/test_dht_api_data.conf       2010-10-03 21:28:06 UTC (rev 
13138)
+++ gnunet/src/dht/test_dht_api_data.conf       2010-10-03 21:37:15 UTC (rev 
13139)
@@ -23,7 +23,7 @@
 PORT = 2092
 
 [dht]
-DEBUG = NO
+DEBUG = YES
 PORT = 12370
 
 [transport]




reply via email to

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