From: Christian Grothoff Date: Tue, 27 Sep 2011 19:19:21 +0000 (+0000) Subject: fixes X-Git-Tag: initial-import-from-subversion-38251~16917 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1f27b71afdc085c84ca14eb48a3f70549b551e38;p=oweals%2Fgnunet.git fixes --- diff --git a/src/dht/dht_api_new.c b/src/dht/dht_api_new.c index 5b2960db2..7d817acd7 100644 --- a/src/dht/dht_api_new.c +++ b/src/dht/dht_api_new.c @@ -135,7 +135,7 @@ struct GNUNET_DHT_GetHandle /** * Unique identifier for this request (for key collisions). */ - uint64_t uid; + uint64_t unique_id; }; @@ -420,7 +420,7 @@ static int process_reply (void *cls, const GNUNET_HashCode * key, void *value) { const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls; - struct GNUNET_DHT_GetHandle *rh = value; + struct GNUNET_DHT_GetHandle *get_handle = value; const struct GNUNET_PeerIdentity *put_path; const struct GNUNET_PeerIdentity *get_path; uint32_t put_path_length; @@ -430,9 +430,13 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) size_t meta_length; const void *data; - if (dht_msg->unique_id != rh->uid) + if (dht_msg->unique_id != get_handle->unique_id) { /* UID mismatch */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Ignoring reply (UID mismatch: %llu/%llu)\n", + dht_msg->unique_id, + get_handle->unique_id); return GNUNET_YES; } msize = ntohs (dht_msg->header.size); @@ -451,13 +455,13 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) put_path = (const struct GNUNET_PeerIdentity *) &dht_msg[1]; get_path = &put_path[put_path_length]; data = &get_path[get_path_length]; - rh->iter (rh->iter_cls, - GNUNET_TIME_absolute_ntoh (dht_msg->expiration), - key, - get_path, get_path_length, - put_path, put_path_length, - ntohl (dht_msg->type), - data_length, data); + get_handle->iter (get_handle->iter_cls, + GNUNET_TIME_absolute_ntoh (dht_msg->expiration), + key, + get_path, get_path_length, + put_path, put_path_length, + ntohl (dht_msg->type), + data_length, data); return GNUNET_YES; } @@ -494,6 +498,8 @@ service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg) do_disconnect (handle); return; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received reply from DHT service\n"); dht_msg = (const struct GNUNET_DHT_ClientResultMessage *) msg; GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests, &dht_msg->key, &process_reply, @@ -717,6 +723,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, get_handle->iter = iter; get_handle->iter_cls = iter_cls; get_handle->message = pending; + get_handle->unique_id = get_msg->unique_id; GNUNET_CONTAINER_multihashmap_put (handle->active_requests, key, get_handle, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index fcfdfc7fd..917d72068 100644 --- a/src/dht/gnunet-service-dht_clients.c +++ b/src/dht/gnunet-service-dht_clients.c @@ -305,7 +305,7 @@ transmit_request (struct ClientQueryRecord *cqr) struct GNUNET_CONTAINER_BloomFilter *reply_bf; GNUNET_STATISTICS_update (GDS_stats, - gettext_noop ("# GET requests from clients injected into P2P network"), 1, + gettext_noop ("# GET requests from clients injected"), 1, GNUNET_NO); reply_bf_mutator = (int32_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index a38da8c73..c56fab27c 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c @@ -197,7 +197,7 @@ test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, * @param cls closure * @param tc context information (why was this task triggered now) */ -void +static void test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PeerContext *peer = cls; @@ -234,7 +234,7 @@ test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls closure * @param tc context information (why was this task triggered now) */ -void +static void test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PeerContext *peer = cls;