From 731a1206abe078241f75ecf7cb77f47a80324f16 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 17 Oct 2012 14:59:27 +0000 Subject: -fixing plan_map over-eager interning as reported by mwachs --- src/fs/gnunet-service-fs_pe.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 6a82720de..1c058eefa 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -220,6 +220,12 @@ static unsigned long long plan_count; /** * Return the query (key in the plan_map) for the given request plan. + * Note that this key may change as there can be multiple pending + * requests for the same key and we just return _one_ of them; this + * particular one might complete while another one might still be + * active, hence the lifetime of the returned hash code is NOT + * necessarily identical to that of the 'struct GSF_RequestPlan' + * given. * * @param rp a request plan * @return the associated query @@ -572,7 +578,7 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr) if (NULL == pp) { pp = GNUNET_malloc (sizeof (struct PeerPlan)); - pp->plan_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_YES); + pp->plan_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); pp->priority_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX); pp->delay_heap = @@ -742,8 +748,7 @@ GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr) plan_count--; GNUNET_break (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (rp->pp->plan_map, - &GSF_pending_request_get_data_ - (rpr->prl->pr)->query, + get_rp_key (rp), rp)); GNUNET_free (rp); } -- cgit v1.2.3