From bd271d337e6e406862e9784051b30045d8d649a6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 3 Oct 2010 21:37:15 +0000 Subject: [PATCH] making test_dht_api work --- src/dht/dht_api.c | 31 ++++++- src/dht/dht_api_get_put.c | 14 +++- src/dht/gnunet-service-dht.c | 54 ++++++++---- src/dht/test_dht_api.c | 149 +++++++++++---------------------- src/dht/test_dht_api_data.conf | 2 +- 5 files changed, 130 insertions(+), 120 deletions(-) diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index c89a92dd5..5abc228a3 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c @@ -231,6 +231,8 @@ try_connect (struct GNUNET_DHT_Handle *handle) _("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 @@ transmit_pending (void *cls, 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 @@ process_reply (void *cls, 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 @@ process_reply (void *cls, 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 @@ service_message_handler (void *cls, { 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 @@ service_message_handler (void *cls, 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 @@ GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle, 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 @@ GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle) route_handle)); GNUNET_free(route_handle->message); GNUNET_free(route_handle); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "DHT route stop request processed\n"); } diff --git a/src/dht/dht_api_get_put.c b/src/dht/dht_api_get_put.c index 362f5dce6..b1b80b01e 100644 --- a/src/dht/dht_api_get_put.c +++ b/src/dht/dht_api_get_put.c @@ -75,7 +75,10 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, 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 @@ get_reply_iterator (void *cls, 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 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, 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, diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 66facaa53..b97f56893 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c @@ -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 @@ send_generic_reply (void *cls, size_t size, void *buf) 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 @@ add_pending_message (struct ClientList *client, 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 @@ send_reply_to_client (struct ClientList *client, 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 @@ static int route_result_message(void *cls, #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 @@ static int route_result_message(void *cls, #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 @@ static int route_result_message(void *cls, 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 @@ static int route_result_message(void *cls, #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 @@ static int route_result_message(void *cls, #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 @@ handle_dht_get (void *cls, #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 @@ handle_dht_find_peer (void *cls, #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 @@ handle_dht_put (void *cls, #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 @@ static int cache_response(void *cls, struct DHT_MessageContext *msg_ctx) #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 @@ static int route_message(void *cls, 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 @@ handle_dht_local_route_request (void *cls, struct GNUNET_SERVER_Client *client, 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 @@ handle_dht_control_message (void *cls, struct GNUNET_SERVER_Client *client, 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 @@ handle_dht_control_message (void *cls, struct GNUNET_SERVER_Client *client, 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 @@ handle_dht_control_message (void *cls, struct GNUNET_SERVER_Client *client, 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); diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index f0b330d3a..b4014a92c 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c @@ -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 @@ GNUNET_SCHEDULER_TaskIdentifier die_task; 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,76 +137,17 @@ end_badly () 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. - * - * @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 /** @@ -235,20 +163,25 @@ test_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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 @@ retry_find_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } 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 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) &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 @@ test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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 @@ test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) &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 @@ test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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, diff --git a/src/dht/test_dht_api_data.conf b/src/dht/test_dht_api_data.conf index 6250eb57b..df2c53d2a 100644 --- a/src/dht/test_dht_api_data.conf +++ b/src/dht/test_dht_api_data.conf @@ -23,7 +23,7 @@ TOTAL_QUOTA_IN = 3932160 PORT = 2092 [dht] -DEBUG = NO +DEBUG = YES PORT = 12370 [transport] -- 2.25.1