From: Christian Grothoff Date: Wed, 19 Oct 2011 20:07:13 +0000 (+0000) Subject: fixing 1830 X-Git-Tag: initial-import-from-subversion-38251~16390 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5bdaaa0231184c53d784fc30e1617baad00da76f;p=oweals%2Fgnunet.git fixing 1830 --- diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 6bf85df92..4555355d2 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -229,25 +229,25 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp) total_delay * 1000LL / plan_count, GNUNET_NO); prd = GSF_pending_request_get_data_ (rp->prl_head->pr); // FIXME: calculate 'rp->priority'! -#if 0 - if (rp->transmission_counter < 32) + if (rp->transmission_counter < 8) delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, - 1LL << rp->transmission_counter); - else - delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX); -#else - if (rp->transmission_counter < 32) - delay = - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, - rp->transmission_counter); + rp->transmission_counter); else if (rp->transmission_counter < 32) delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, - 32 + (1LL << rp->transmission_counter)); + 8 + (1LL << (rp->transmission_counter - 8))); else - delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX); -#endif + delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, + 8 + (1LL << 24)); + delay.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, + delay.rel_value + 1); + if (rp->transmission_counter != 0) + delay.rel_value += TTL_DECREMENT; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Considering (re)transmission number %u in %llu ms\n", + (unsigned int) rp->transmission_counter, + (unsigned long long) delay.rel_value); rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay); #if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 7d205fef9..63ae3a75f 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -175,6 +175,12 @@ static struct GNUNET_LOAD_Value *datastore_put_load; static int active_to_migration; +/** + * Size of the datastore queue we assume for common requests. + * Determined based on the network quota. + */ +static unsigned int datastore_queue_size; + /** * Heap with the request that will expire next at the top. Contains * pointers of type "struct PendingRequest*"; these will *also* be @@ -1225,7 +1231,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, /* queue priority */ , (0 != (GSF_PRO_PRIORITY_UNLIMITED & - pr->public_data.options)) ? UINT_MAX : 16 + pr->public_data.options)) ? UINT_MAX : datastore_queue_size /* max queue size */ , GNUNET_TIME_UNIT_FOREVER_REL, &process_local_reply, pr); @@ -1264,7 +1270,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, /* queue priority */ , (0 != (GSF_PRO_PRIORITY_UNLIMITED & - pr->public_data.options)) ? UINT_MAX : 16 + pr->public_data.options)) ? UINT_MAX : datastore_queue_size /* max queue size */ , GNUNET_TIME_UNIT_FOREVER_REL, &process_local_reply, pr); @@ -1323,7 +1329,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, /* queue priority */ , (0 != (GSF_PRO_PRIORITY_UNLIMITED & pr-> - public_data.options)) ? UINT_MAX : 16 + public_data.options)) ? UINT_MAX : datastore_queue_size /* max queue size */ , GNUNET_TIME_UNIT_FOREVER_REL, &process_local_reply, pr); @@ -1399,7 +1405,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, /* queue priority */ , (0 != (GSF_PRO_PRIORITY_UNLIMITED & pr-> - public_data.options)) ? UINT_MAX : 16 + public_data.options)) ? UINT_MAX : datastore_queue_size /* max queue size */ , GNUNET_TIME_UNIT_FOREVER_REL, &process_local_reply, pr); @@ -1547,6 +1553,8 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, void GSF_pending_request_init_ () { + unsigned long long bps; + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (GSF_cfg, "fs", "MAX_PENDING_REQUESTS", @@ -1557,6 +1565,22 @@ GSF_pending_request_init_ () ("Configuration fails to specify `%s', assuming default value."), "MAX_PENDING_REQUESTS"); } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_number (GSF_cfg, + "core", + "TOTAL_QUOTA_OUT", + &bps)) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _ + ("Configuration fails to specify `%s', assuming default value."), + "TOTAL_QUOTA_IN"); + bps = 65536; + } + /* queue size should be #queries we can have pending and satisfy within + a carry interval: */ + datastore_queue_size = bps * GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S / DBLOCK_SIZE; + active_to_migration = GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, "FS", "CONTENT_CACHING"); datastore_put_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index bb8c8d8c2..66dc38b23 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c @@ -32,7 +32,7 @@ /** * File-size we use for testing. */ -#define FILESIZE (1024 * 1024 * 10) +#define FILESIZE (1024 * 1024 * 100) /** * How long until we give up on transmitting the message?