aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
commit71ea5bd2d05058008e604ffd42993be9c7250e04 (patch)
treea5074671ddfaa9d1621a4182fc95a91a98b3d536 /src/fs
parentb335777fd435142c16eb05e86c8a64a4b1a45447 (diff)
downloadgnunet-71ea5bd2d05058008e604ffd42993be9c7250e04.tar.gz
gnunet-71ea5bd2d05058008e604ffd42993be9c7250e04.zip
-fixing indentation
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_api.c2
-rw-r--r--src/fs/fs_search.c2
-rw-r--r--src/fs/gnunet-fs.c3
-rw-r--r--src/fs/gnunet-service-fs.c18
-rw-r--r--src/fs/gnunet-service-fs_lc.c54
-rw-r--r--src/fs/gnunet-service-fs_lc.h2
-rw-r--r--src/fs/gnunet-service-fs_pe.c48
-rw-r--r--src/fs/gnunet-service-fs_pr.c2
8 files changed, 66 insertions, 65 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index ce4b3b887..ab351a209 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -2464,7 +2464,7 @@ deserialize_download (struct GNUNET_FS_Handle *h,
2464 } 2464 }
2465 if (parent != NULL) 2465 if (parent != NULL)
2466 { 2466 {
2467 GNUNET_abort (); // for debugging for now - FIXME 2467 GNUNET_abort (); // for debugging for now - FIXME
2468 GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc); 2468 GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
2469 } 2469 }
2470 if (search != NULL) 2470 if (search != NULL)
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index a2346aab9..052bf83d2 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -995,7 +995,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
995 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt); 995 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
996 if (sc->search_request_map_offset < sqms) 996 if (sc->search_request_map_offset < sqms)
997 GNUNET_assert (mbc.put_cnt > 0); 997 GNUNET_assert (mbc.put_cnt > 0);
998 998
999 sm->header.size = htons (msize); 999 sm->header.size = htons (msize);
1000 sm->type = htonl (GNUNET_BLOCK_TYPE_ANY); 1000 sm->type = htonl (GNUNET_BLOCK_TYPE_ANY);
1001 sm->anonymity_level = htonl (sc->anonymity); 1001 sm->anonymity_level = htonl (sc->anonymity);
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 9025b71da..dc86ce984 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -93,7 +93,8 @@ run (void *cls, char *const *args, const char *cfgfile,
93{ 93{
94 if (list_indexed_files) 94 if (list_indexed_files)
95 { 95 {
96 fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END); 96 fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE,
97 GNUNET_FS_OPTIONS_END);
97 if (NULL == fs) 98 if (NULL == fs)
98 { 99 {
99 ret = 1; 100 ret = 1;
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 5923823ef..2a90b538c 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -232,9 +232,9 @@ update_latencies (const struct GNUNET_ATS_Information *atsi,
232 { 232 {
233 if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY) 233 if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY)
234 { 234 {
235 GSF_avg_latency.rel_value = (GSF_avg_latency.rel_value * 31 + 235 GSF_avg_latency.rel_value =
236 GNUNET_MIN (5000, 236 (GSF_avg_latency.rel_value * 31 +
237 ntohl (atsi[i].value))) / 32; 237 GNUNET_MIN (5000, ntohl (atsi[i].value))) / 32;
238 GNUNET_STATISTICS_set (GSF_stats, 238 GNUNET_STATISTICS_set (GSF_stats,
239 gettext_noop 239 gettext_noop
240 ("# running average P2P latency (ms)"), 240 ("# running average P2P latency (ms)"),
@@ -405,8 +405,7 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client,
405 int ret; 405 int ret;
406 406
407 pr = NULL; 407 pr = NULL;
408 ret = GSF_local_client_start_search_handler_ (client, message, 408 ret = GSF_local_client_start_search_handler_ (client, message, &pr);
409 &pr);
410 switch (ret) 409 switch (ret)
411 { 410 {
412 case GNUNET_SYSERR: 411 case GNUNET_SYSERR:
@@ -572,11 +571,10 @@ main_init (struct GNUNET_SERVER_Handle *server,
572 {NULL, NULL, 0, 0} 571 {NULL, NULL, 0, 0}
573 }; 572 };
574 573
575 GSF_core = GNUNET_CORE_connect (GSF_cfg, 1, 574 GSF_core =
576 NULL, &peer_init_handler, 575 GNUNET_CORE_connect (GSF_cfg, 1, NULL, &peer_init_handler,
577 &peer_connect_handler, 576 &peer_connect_handler, &GSF_peer_disconnect_handler_,
578 &GSF_peer_disconnect_handler_, NULL, 577 NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
579 GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
580 if (NULL == GSF_core) 578 if (NULL == GSF_core)
581 { 579 {
582 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 580 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 65dece707..502cef941 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -295,7 +295,7 @@ int
295GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, 295GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
296 const struct GNUNET_MessageHeader 296 const struct GNUNET_MessageHeader
297 *message, 297 *message,
298 struct GSF_PendingRequest **prptr) 298 struct GSF_PendingRequest **prptr)
299{ 299{
300 static GNUNET_HashCode all_zeros; 300 static GNUNET_HashCode all_zeros;
301 const struct SearchMessage *sm; 301 const struct SearchMessage *sm;
@@ -350,45 +350,45 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
350 { 350 {
351#if DEBUG_FS_CLIENT 351#if DEBUG_FS_CLIENT
352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
353 "Have existing request, merging content-seen lists.\n"); 353 "Have existing request, merging content-seen lists.\n");
354#endif 354#endif
355 GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], 355 GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc);
356 sc);
357 GNUNET_STATISTICS_update (GSF_stats, 356 GNUNET_STATISTICS_update (GSF_stats,
358 gettext_noop 357 gettext_noop
359 ("# client searches updated (merged content seen list)"), 358 ("# client searches updated (merged content seen list)"),
360 1, GNUNET_NO); 359 1, GNUNET_NO);
361 } 360 }
362 else 361 else
363 { 362 {
364 GNUNET_STATISTICS_update (GSF_stats, 363 GNUNET_STATISTICS_update (GSF_stats,
365 gettext_noop ("# client searches active"), 1, 364 gettext_noop ("# client searches active"), 1,
366 GNUNET_NO); 365 GNUNET_NO);
367 cr = GNUNET_malloc (sizeof (struct ClientRequest)); 366 cr = GNUNET_malloc (sizeof (struct ClientRequest));
368 cr->lc = lc; 367 cr->lc = lc;
369 GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr); 368 GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr);
370 options = GSF_PRO_LOCAL_REQUEST; 369 options = GSF_PRO_LOCAL_REQUEST;
371 if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options))) 370 if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
372 options |= GSF_PRO_LOCAL_ONLY; 371 options |= GSF_PRO_LOCAL_ONLY;
373 cr->pr = GSF_pending_request_create_ (options, type, &sm->query, 372 cr->pr = GSF_pending_request_create_ (options, type, &sm->query, (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
374 (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */ 373 : NULL,
375 : NULL, 374 (0 !=
376 (0 != 375 memcmp (&sm->target, &all_zeros,
377 memcmp (&sm->target, &all_zeros, 376 sizeof (GNUNET_HashCode)))
378 sizeof (GNUNET_HashCode))) 377 ? (const struct GNUNET_PeerIdentity *)
379 ? (const struct GNUNET_PeerIdentity *) 378 &sm->target : NULL, NULL, 0,
380 &sm->target : NULL, NULL, 0, 379 0 /* bf */ ,
381 0 /* bf */ , 380 ntohl (sm->anonymity_level),
382 ntohl (sm->anonymity_level), 381 0 /* priority */ ,
383 0 /* priority */ , 382 0 /* ttl */ ,
384 0 /* ttl */ , 383 0 /* sender PID */ ,
385 0 /* sender PID */ , 384 0 /* origin PID */ ,
386 0 /* origin PID */ , 385 (const GNUNET_HashCode *) &sm[1], sc,
387 (const GNUNET_HashCode *) &sm[1], sc, 386 &client_response_handler, cr);
388 &client_response_handler, cr);
389 } 387 }
390 *prptr = cr->pr; 388 *prptr = cr->pr;
391 return (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options))) ? GNUNET_NO : GNUNET_YES; 389 return (0 !=
390 (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options))) ? GNUNET_NO :
391 GNUNET_YES;
392} 392}
393 393
394 394
diff --git a/src/fs/gnunet-service-fs_lc.h b/src/fs/gnunet-service-fs_lc.h
index 78b23dc40..3bddb8947 100644
--- a/src/fs/gnunet-service-fs_lc.h
+++ b/src/fs/gnunet-service-fs_lc.h
@@ -57,7 +57,7 @@ int
57GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, 57GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
58 const struct GNUNET_MessageHeader 58 const struct GNUNET_MessageHeader
59 *message, 59 *message,
60 struct GSF_PendingRequest **prptr); 60 struct GSF_PendingRequest **prptr);
61 61
62 62
63/** 63/**
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c
index 200d7a0e4..0a40065cc 100644
--- a/src/fs/gnunet-service-fs_pe.c
+++ b/src/fs/gnunet-service-fs_pe.c
@@ -265,7 +265,7 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
265 gettext_noop ("# average retransmission delay (ms)"), 265 gettext_noop ("# average retransmission delay (ms)"),
266 total_delay * 1000LL / plan_count, GNUNET_NO); 266 total_delay * 1000LL / plan_count, GNUNET_NO);
267 prd = GSF_pending_request_get_data_ (rp->prl_head->pr); 267 prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
268 268
269 if (rp->transmission_counter < 8) 269 if (rp->transmission_counter < 8)
270 delay = 270 delay =
271 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 271 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
@@ -283,30 +283,32 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
283 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 283 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
284 delay.rel_value + 1); 284 delay.rel_value + 1);
285 /* Add 0.01 to avg_delay to avoid division-by-zero later */ 285 /* Add 0.01 to avg_delay to avoid division-by-zero later */
286 avg_delay = (((avg_delay * (N-1.0)) + delay.rel_value) / N) + 0.01; 286 avg_delay = (((avg_delay * (N - 1.0)) + delay.rel_value) / N) + 0.01;
287 287
288 /* 288 /*
289 For the priority, we need to consider a few basic rules: 289 * For the priority, we need to consider a few basic rules:
290 1) if we just started requesting (delay is small), we should 290 * 1) if we just started requesting (delay is small), we should
291 virtually always have a priority of zero. 291 * virtually always have a priority of zero.
292 2) for requests with average latency, our priority should match 292 * 2) for requests with average latency, our priority should match
293 the average priority observed on the network 293 * the average priority observed on the network
294 3) even the longest-running requests should not be WAY out of 294 * 3) even the longest-running requests should not be WAY out of
295 the observed average (thus we bound by a factor of 2) 295 * the observed average (thus we bound by a factor of 2)
296 4) we add +1 to the observed average priority to avoid everyone 296 * 4) we add +1 to the observed average priority to avoid everyone
297 staying put at zero (2 * 0 = 0...). 297 * staying put at zero (2 * 0 = 0...).
298 298 *
299 Using the specific calculation below, we get: 299 * Using the specific calculation below, we get:
300 300 *
301 delay = 0 => priority = 0; 301 * delay = 0 => priority = 0;
302 delay = avg delay => priority = running-average-observed-priority; 302 * delay = avg delay => priority = running-average-observed-priority;
303 delay >> avg_delay => priority = 2 * running-average-observed-priority; 303 * delay >> avg_delay => priority = 2 * running-average-observed-priority;
304 304 *
305 which satisfies all of the rules above. 305 * which satisfies all of the rules above.
306 306 *
307 Note: M_PI_4 = PI/4 = arctan(1) 307 * Note: M_PI_4 = PI/4 = arctan(1)
308 */ 308 */
309 rp->priority = round ((GSF_current_priorities + 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4; 309 rp->priority =
310 round ((GSF_current_priorities +
311 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4;
310 /* Note: usage of 'round' and 'atan' requires -lm */ 312 /* Note: usage of 'round' and 'atan' requires -lm */
311 313
312 if (rp->transmission_counter != 0) 314 if (rp->transmission_counter != 0)
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index e6add21b9..1bd16c9f1 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -1588,7 +1588,7 @@ GSF_pending_request_init_ ()
1588 } 1588 }
1589 if (GNUNET_OK != 1589 if (GNUNET_OK !=
1590 GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT", 1590 GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT",
1591 &bps)) 1591 &bps))
1592 { 1592 {
1593 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1593 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1594 _ 1594 _