From 8b23412a0e353778e83b370260e40d63a18c3927 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 21 Apr 2011 13:05:22 +0000 Subject: [PATCH] cancel completed requests --- src/fs/gnunet-service-fs_cp.c | 8 +------- src/fs/gnunet-service-fs_pe.c | 14 +++++++++++++- src/fs/gnunet-service-fs_pr.c | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 2aec83efe..92461e477 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -857,12 +857,6 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, return NULL; } gm = (const struct GetMessage*) message; -#if DEBUG_FS - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Received request for `%s' from `%s'\n", - GNUNET_h2s (&gm->query), - GNUNET_i2s (other)); -#endif type = ntohl (gm->type); bm = ntohl (gm->hash_bitmap); bits = 0; @@ -1551,7 +1545,7 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, { #if DEBUG_FS && 0 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Migration already blocked for another %llu ms\n", + "Migration already blocked for another %llu ms\n", (unsigned long long) GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value); #endif return; /* already blocked */ diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index d0e30f025..b3f46cf45 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -134,7 +134,19 @@ plan (struct PeerPlan *pp, prd = GSF_pending_request_get_data_ (rp->pr); // FIXME: calculate 'rp->earliest_transmission'! - // fIXME: claculate 'rp->priority'! + // FIXME: claculate 'rp->priority'! + rp->earliest_transmission + = GNUNET_TIME_relative_to_absolute + (GNUNET_TIME_relative_multiply + (GNUNET_TIME_UNIT_SECONDS, + rp->transmission_counter)); +#if DEBUG_FS + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Earliest (re)transmission for `%s' in %us\n", + GNUNET_h2s (&prd->query), + rp->transmission_counter); +#endif + if (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value == 0) rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 16389e130..f8ca82800 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -266,6 +266,12 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, struct GSF_PendingRequest *pr; struct GSF_PendingRequest *dpr; +#if DEBUG_FS + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Creating request handle for `%s' of type %d\n", + GNUNET_h2s (query), + type); +#endif pr = GNUNET_malloc (sizeof (struct GSF_PendingRequest)); pr->public_data.query = *query; if (GNUNET_BLOCK_TYPE_FS_SBLOCK == type) @@ -446,7 +452,13 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, int64_t ttl; int do_route; - +#if DEBUG_FS + if (buf_size > 0) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Building request message for `%s' of type %d\n", + GNUNET_h2s (&pr->public_data.query), + pr->public_data.type); +#endif k = 0; bm = 0; do_route = (0 == (pr->public_data.options & GSF_PRO_FORWARD_ONLY)); @@ -697,6 +709,7 @@ process_reply (void *cls, prq->expiration, prq->type, prq->data, prq->size); + GSF_pending_request_cancel_ (pr); return GNUNET_YES; case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: GNUNET_STATISTICS_update (GSF_stats, -- 2.25.1