summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
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,
}
if (parent != NULL)
{
- GNUNET_abort (); // for debugging for now - FIXME
+ GNUNET_abort (); // for debugging for now - FIXME
GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
}
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)
mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
if (sc->search_request_map_offset < sqms)
GNUNET_assert (mbc.put_cnt > 0);
-
+
sm->header.size = htons (msize);
sm->type = htonl (GNUNET_BLOCK_TYPE_ANY);
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,
{
if (list_indexed_files)
{
- fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
+ fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE,
+ GNUNET_FS_OPTIONS_END);
if (NULL == fs)
{
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,
{
if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY)
{
- GSF_avg_latency.rel_value = (GSF_avg_latency.rel_value * 31 +
- GNUNET_MIN (5000,
- ntohl (atsi[i].value))) / 32;
+ GSF_avg_latency.rel_value =
+ (GSF_avg_latency.rel_value * 31 +
+ GNUNET_MIN (5000, ntohl (atsi[i].value))) / 32;
GNUNET_STATISTICS_set (GSF_stats,
gettext_noop
("# running average P2P latency (ms)"),
@@ -405,8 +405,7 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client,
int ret;
pr = NULL;
- ret = GSF_local_client_start_search_handler_ (client, message,
- &pr);
+ ret = GSF_local_client_start_search_handler_ (client, message, &pr);
switch (ret)
{
case GNUNET_SYSERR:
@@ -572,11 +571,10 @@ main_init (struct GNUNET_SERVER_Handle *server,
{NULL, NULL, 0, 0}
};
- GSF_core = GNUNET_CORE_connect (GSF_cfg, 1,
- NULL, &peer_init_handler,
- &peer_connect_handler,
- &GSF_peer_disconnect_handler_, NULL,
- GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
+ GSF_core =
+ GNUNET_CORE_connect (GSF_cfg, 1, NULL, &peer_init_handler,
+ &peer_connect_handler, &GSF_peer_disconnect_handler_,
+ NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
if (NULL == GSF_core)
{
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
GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader
*message,
- struct GSF_PendingRequest **prptr)
+ struct GSF_PendingRequest **prptr)
{
static GNUNET_HashCode all_zeros;
const struct SearchMessage *sm;
@@ -350,45 +350,45 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
{
#if DEBUG_FS_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Have existing request, merging content-seen lists.\n");
+ "Have existing request, merging content-seen lists.\n");
#endif
- GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1],
- sc);
+ GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc);
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop
- ("# client searches updated (merged content seen list)"),
- 1, GNUNET_NO);
- }
+ gettext_noop
+ ("# client searches updated (merged content seen list)"),
+ 1, GNUNET_NO);
+ }
else
{
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# client searches active"), 1,
- GNUNET_NO);
+ gettext_noop ("# client searches active"), 1,
+ GNUNET_NO);
cr = GNUNET_malloc (sizeof (struct ClientRequest));
cr->lc = lc;
GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr);
options = GSF_PRO_LOCAL_REQUEST;
if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
options |= GSF_PRO_LOCAL_ONLY;
- cr->pr = GSF_pending_request_create_ (options, type, &sm->query,
- (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
- : NULL,
- (0 !=
- memcmp (&sm->target, &all_zeros,
- sizeof (GNUNET_HashCode)))
- ? (const struct GNUNET_PeerIdentity *)
- &sm->target : NULL, NULL, 0,
- 0 /* bf */ ,
- ntohl (sm->anonymity_level),
- 0 /* priority */ ,
- 0 /* ttl */ ,
- 0 /* sender PID */ ,
- 0 /* origin PID */ ,
- (const GNUNET_HashCode *) &sm[1], sc,
- &client_response_handler, cr);
+ cr->pr = GSF_pending_request_create_ (options, type, &sm->query, (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
+ : NULL,
+ (0 !=
+ memcmp (&sm->target, &all_zeros,
+ sizeof (GNUNET_HashCode)))
+ ? (const struct GNUNET_PeerIdentity *)
+ &sm->target : NULL, NULL, 0,
+ 0 /* bf */ ,
+ ntohl (sm->anonymity_level),
+ 0 /* priority */ ,
+ 0 /* ttl */ ,
+ 0 /* sender PID */ ,
+ 0 /* origin PID */ ,
+ (const GNUNET_HashCode *) &sm[1], sc,
+ &client_response_handler, cr);
}
*prptr = cr->pr;
- return (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options))) ? GNUNET_NO : GNUNET_YES;
+ return (0 !=
+ (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options))) ? GNUNET_NO :
+ GNUNET_YES;
}
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
GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader
*message,
- struct GSF_PendingRequest **prptr);
+ struct GSF_PendingRequest **prptr);
/**
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)
gettext_noop ("# average retransmission delay (ms)"),
total_delay * 1000LL / plan_count, GNUNET_NO);
prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
-
+
if (rp->transmission_counter < 8)
delay =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
@@ -283,30 +283,32 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
delay.rel_value + 1);
/* Add 0.01 to avg_delay to avoid division-by-zero later */
- avg_delay = (((avg_delay * (N-1.0)) + delay.rel_value) / N) + 0.01;
+ avg_delay = (((avg_delay * (N - 1.0)) + delay.rel_value) / N) + 0.01;
/*
- For the priority, we need to consider a few basic rules:
- 1) if we just started requesting (delay is small), we should
- virtually always have a priority of zero.
- 2) for requests with average latency, our priority should match
- the average priority observed on the network
- 3) even the longest-running requests should not be WAY out of
- the observed average (thus we bound by a factor of 2)
- 4) we add +1 to the observed average priority to avoid everyone
- staying put at zero (2 * 0 = 0...).
-
- Using the specific calculation below, we get:
-
- delay = 0 => priority = 0;
- delay = avg delay => priority = running-average-observed-priority;
- delay >> avg_delay => priority = 2 * running-average-observed-priority;
-
- which satisfies all of the rules above.
-
- Note: M_PI_4 = PI/4 = arctan(1)
- */
- rp->priority = round ((GSF_current_priorities + 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4;
+ * For the priority, we need to consider a few basic rules:
+ * 1) if we just started requesting (delay is small), we should
+ * virtually always have a priority of zero.
+ * 2) for requests with average latency, our priority should match
+ * the average priority observed on the network
+ * 3) even the longest-running requests should not be WAY out of
+ * the observed average (thus we bound by a factor of 2)
+ * 4) we add +1 to the observed average priority to avoid everyone
+ * staying put at zero (2 * 0 = 0...).
+ *
+ * Using the specific calculation below, we get:
+ *
+ * delay = 0 => priority = 0;
+ * delay = avg delay => priority = running-average-observed-priority;
+ * delay >> avg_delay => priority = 2 * running-average-observed-priority;
+ *
+ * which satisfies all of the rules above.
+ *
+ * Note: M_PI_4 = PI/4 = arctan(1)
+ */
+ rp->priority =
+ round ((GSF_current_priorities +
+ 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4;
/* Note: usage of 'round' and 'atan' requires -lm */
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_ ()
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT",
- &bps))
+ &bps))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_