From 21a4795f1918e010a51b0d189fe01f77e1f5bbd6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 19 Dec 2011 14:10:15 +0000 Subject: [PATCH] actually limit FS memory consumption by limiting how many requests we track from other peers (respective GSF-option had not been set; new code also inverts the meaning of the bit, so it does not have to be set for peers but rather is now set for clients to excempt them from the limitation) --- src/fs/gnunet-service-fs_cp.c | 2 +- src/fs/gnunet-service-fs_pr.c | 2 +- src/fs/gnunet-service-fs_pr.h | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 7560975db..968cdffcb 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -1231,7 +1231,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, (0 != (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? ((const struct GNUNET_PeerIdentity *) &opt[bits++]) : NULL; - options = 0; + options = GSF_PRO_DEFAULTS; spid = 0; if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) || (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 12245c8a6..49f395ef6 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -345,7 +345,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, } GNUNET_CONTAINER_multihashmap_put (pr_map, query, pr, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); - if (0 != (options & GSF_PRO_REQUEST_EXPIRES)) + if (0 == (options & GSF_PRO_REQUEST_NEVER_EXPIRES)) { pr->hnode = GNUNET_CONTAINER_heap_insert (requests_by_expiration_heap, pr, diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index e15ea0b54..f435cf8d6 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h @@ -34,6 +34,12 @@ */ enum GSF_PendingRequestOptions { + + /** + * No special options (P2P-default). + */ + GSF_PRO_DEFAULTS = 0, + /** * Request must only be processed locally. */ @@ -47,7 +53,7 @@ enum GSF_PendingRequestOptions /** * Request persists indefinitely (no expiration). */ - GSF_PRO_REQUEST_EXPIRES = 4, + GSF_PRO_REQUEST_NEVER_EXPIRES = 4, /** * Request is allowed to refresh bloomfilter and change mingle value. @@ -63,7 +69,7 @@ enum GSF_PendingRequestOptions * Option mask for typical local requests. */ GSF_PRO_LOCAL_REQUEST = - (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) + (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED | GSF_PRO_REQUEST_NEVER_EXPIRES) }; -- 2.25.1