diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-19 20:07:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-19 20:07:13 +0000 |
commit | 5bdaaa0231184c53d784fc30e1617baad00da76f (patch) | |
tree | 4227fd6355cee1ac5c9398c55f508c5363e51c68 /src/fs | |
parent | e3bb58c8e0f73697c22397165d0ff24424e32839 (diff) | |
download | gnunet-5bdaaa0231184c53d784fc30e1617baad00da76f.tar.gz gnunet-5bdaaa0231184c53d784fc30e1617baad00da76f.zip |
fixing 1830
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 26 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 32 | ||||
-rw-r--r-- | src/fs/perf_gnunet_service_fs_p2p.c | 2 |
3 files changed, 42 insertions, 18 deletions
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) | |||
229 | total_delay * 1000LL / plan_count, GNUNET_NO); | 229 | total_delay * 1000LL / plan_count, GNUNET_NO); |
230 | prd = GSF_pending_request_get_data_ (rp->prl_head->pr); | 230 | prd = GSF_pending_request_get_data_ (rp->prl_head->pr); |
231 | // FIXME: calculate 'rp->priority'! | 231 | // FIXME: calculate 'rp->priority'! |
232 | #if 0 | 232 | if (rp->transmission_counter < 8) |
233 | if (rp->transmission_counter < 32) | ||
234 | delay = | 233 | delay = |
235 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 234 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, |
236 | 1LL << rp->transmission_counter); | 235 | rp->transmission_counter); |
237 | else | ||
238 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX); | ||
239 | #else | ||
240 | if (rp->transmission_counter < 32) | ||
241 | delay = | ||
242 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | ||
243 | rp->transmission_counter); | ||
244 | else if (rp->transmission_counter < 32) | 236 | else if (rp->transmission_counter < 32) |
245 | delay = | 237 | delay = |
246 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 238 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, |
247 | 32 + (1LL << rp->transmission_counter)); | 239 | 8 + (1LL << (rp->transmission_counter - 8))); |
248 | else | 240 | else |
249 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX); | 241 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, |
250 | #endif | 242 | 8 + (1LL << 24)); |
243 | delay.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
244 | delay.rel_value + 1); | ||
245 | if (rp->transmission_counter != 0) | ||
246 | delay.rel_value += TTL_DECREMENT; | ||
247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
248 | "Considering (re)transmission number %u in %llu ms\n", | ||
249 | (unsigned int) rp->transmission_counter, | ||
250 | (unsigned long long) delay.rel_value); | ||
251 | rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay); | 251 | rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay); |
252 | #if DEBUG_FS | 252 | #if DEBUG_FS |
253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 253 | 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 | |||
@@ -176,6 +176,12 @@ static int active_to_migration; | |||
176 | 176 | ||
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Size of the datastore queue we assume for common requests. | ||
180 | * Determined based on the network quota. | ||
181 | */ | ||
182 | static unsigned int datastore_queue_size; | ||
183 | |||
184 | /** | ||
179 | * Heap with the request that will expire next at the top. Contains | 185 | * Heap with the request that will expire next at the top. Contains |
180 | * pointers of type "struct PendingRequest*"; these will *also* be | 186 | * pointers of type "struct PendingRequest*"; these will *also* be |
181 | * aliased from the "requests_by_peer" data structures and the | 187 | * aliased from the "requests_by_peer" data structures and the |
@@ -1225,7 +1231,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, | |||
1225 | /* queue priority */ , | 1231 | /* queue priority */ , |
1226 | (0 != | 1232 | (0 != |
1227 | (GSF_PRO_PRIORITY_UNLIMITED & | 1233 | (GSF_PRO_PRIORITY_UNLIMITED & |
1228 | pr->public_data.options)) ? UINT_MAX : 16 | 1234 | pr->public_data.options)) ? UINT_MAX : datastore_queue_size |
1229 | /* max queue size */ , | 1235 | /* max queue size */ , |
1230 | GNUNET_TIME_UNIT_FOREVER_REL, | 1236 | GNUNET_TIME_UNIT_FOREVER_REL, |
1231 | &process_local_reply, pr); | 1237 | &process_local_reply, pr); |
@@ -1264,7 +1270,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, | |||
1264 | /* queue priority */ , | 1270 | /* queue priority */ , |
1265 | (0 != | 1271 | (0 != |
1266 | (GSF_PRO_PRIORITY_UNLIMITED & | 1272 | (GSF_PRO_PRIORITY_UNLIMITED & |
1267 | pr->public_data.options)) ? UINT_MAX : 16 | 1273 | pr->public_data.options)) ? UINT_MAX : datastore_queue_size |
1268 | /* max queue size */ , | 1274 | /* max queue size */ , |
1269 | GNUNET_TIME_UNIT_FOREVER_REL, | 1275 | GNUNET_TIME_UNIT_FOREVER_REL, |
1270 | &process_local_reply, pr); | 1276 | &process_local_reply, pr); |
@@ -1323,7 +1329,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, | |||
1323 | /* queue priority */ , | 1329 | /* queue priority */ , |
1324 | (0 != | 1330 | (0 != |
1325 | (GSF_PRO_PRIORITY_UNLIMITED & pr-> | 1331 | (GSF_PRO_PRIORITY_UNLIMITED & pr-> |
1326 | public_data.options)) ? UINT_MAX : 16 | 1332 | public_data.options)) ? UINT_MAX : datastore_queue_size |
1327 | /* max queue size */ , | 1333 | /* max queue size */ , |
1328 | GNUNET_TIME_UNIT_FOREVER_REL, | 1334 | GNUNET_TIME_UNIT_FOREVER_REL, |
1329 | &process_local_reply, pr); | 1335 | &process_local_reply, pr); |
@@ -1399,7 +1405,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, | |||
1399 | /* queue priority */ , | 1405 | /* queue priority */ , |
1400 | (0 != | 1406 | (0 != |
1401 | (GSF_PRO_PRIORITY_UNLIMITED & pr-> | 1407 | (GSF_PRO_PRIORITY_UNLIMITED & pr-> |
1402 | public_data.options)) ? UINT_MAX : 16 | 1408 | public_data.options)) ? UINT_MAX : datastore_queue_size |
1403 | /* max queue size */ , | 1409 | /* max queue size */ , |
1404 | GNUNET_TIME_UNIT_FOREVER_REL, | 1410 | GNUNET_TIME_UNIT_FOREVER_REL, |
1405 | &process_local_reply, pr); | 1411 | &process_local_reply, pr); |
@@ -1547,6 +1553,8 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, | |||
1547 | void | 1553 | void |
1548 | GSF_pending_request_init_ () | 1554 | GSF_pending_request_init_ () |
1549 | { | 1555 | { |
1556 | unsigned long long bps; | ||
1557 | |||
1550 | if (GNUNET_OK != | 1558 | if (GNUNET_OK != |
1551 | GNUNET_CONFIGURATION_get_value_number (GSF_cfg, "fs", | 1559 | GNUNET_CONFIGURATION_get_value_number (GSF_cfg, "fs", |
1552 | "MAX_PENDING_REQUESTS", | 1560 | "MAX_PENDING_REQUESTS", |
@@ -1557,6 +1565,22 @@ GSF_pending_request_init_ () | |||
1557 | ("Configuration fails to specify `%s', assuming default value."), | 1565 | ("Configuration fails to specify `%s', assuming default value."), |
1558 | "MAX_PENDING_REQUESTS"); | 1566 | "MAX_PENDING_REQUESTS"); |
1559 | } | 1567 | } |
1568 | if (GNUNET_OK != | ||
1569 | GNUNET_CONFIGURATION_get_value_number (GSF_cfg, | ||
1570 | "core", | ||
1571 | "TOTAL_QUOTA_OUT", | ||
1572 | &bps)) | ||
1573 | { | ||
1574 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1575 | _ | ||
1576 | ("Configuration fails to specify `%s', assuming default value."), | ||
1577 | "TOTAL_QUOTA_IN"); | ||
1578 | bps = 65536; | ||
1579 | } | ||
1580 | /* queue size should be #queries we can have pending and satisfy within | ||
1581 | a carry interval: */ | ||
1582 | datastore_queue_size = bps * GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S / DBLOCK_SIZE; | ||
1583 | |||
1560 | active_to_migration = | 1584 | active_to_migration = |
1561 | GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, "FS", "CONTENT_CACHING"); | 1585 | GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, "FS", "CONTENT_CACHING"); |
1562 | datastore_put_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); | 1586 | 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 @@ | |||
32 | /** | 32 | /** |
33 | * File-size we use for testing. | 33 | * File-size we use for testing. |
34 | */ | 34 | */ |
35 | #define FILESIZE (1024 * 1024 * 10) | 35 | #define FILESIZE (1024 * 1024 * 100) |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * How long until we give up on transmitting the message? | 38 | * How long until we give up on transmitting the message? |