aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r--src/fs/gnunet-service-fs.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 404993130..f588ee9c4 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -226,19 +226,20 @@ GSF_test_get_load_too_high_ (uint32_t priority)
226 */ 226 */
227static void 227static void
228update_latencies (const struct GNUNET_ATS_Information *atsi, 228update_latencies (const struct GNUNET_ATS_Information *atsi,
229 unsigned int atsi_count) 229 unsigned int atsi_count)
230{ 230{
231 unsigned int i; 231 unsigned int i;
232 232
233 for (i=0;i<atsi_count;i++) 233 for (i = 0; i < atsi_count; i++)
234 { 234 {
235 if (ntohl(atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY) 235 if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY)
236 { 236 {
237 GSF_avg_latency.rel_value = (GSF_avg_latency.rel_value * 31 + ntohl (atsi[i].value)) / 32; 237 GSF_avg_latency.rel_value =
238 (GSF_avg_latency.rel_value * 31 + ntohl (atsi[i].value)) / 32;
238 GNUNET_STATISTICS_set (GSF_stats, 239 GNUNET_STATISTICS_set (GSF_stats,
239 gettext_noop ("# running average P2P latency (ms)"), 240 gettext_noop
240 GSF_avg_latency.rel_value, 241 ("# running average P2P latency (ms)"),
241 GNUNET_NO); 242 GSF_avg_latency.rel_value, GNUNET_NO);
242 break; 243 break;
243 } 244 }
244 } 245 }
@@ -261,7 +262,7 @@ static int
261handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other, 262handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other,
262 const struct GNUNET_MessageHeader *message, 263 const struct GNUNET_MessageHeader *message,
263 const struct GNUNET_ATS_Information *atsi, 264 const struct GNUNET_ATS_Information *atsi,
264 unsigned int atsi_count) 265 unsigned int atsi_count)
265{ 266{
266 struct GSF_ConnectedPeer *cp; 267 struct GSF_ConnectedPeer *cp;
267 268
@@ -294,13 +295,11 @@ consider_request_for_forwarding (void *cls,
294{ 295{
295 struct GSF_PendingRequest *pr = cls; 296 struct GSF_PendingRequest *pr = cls;
296 297
297 if (GNUNET_YES != 298 if (GNUNET_YES != GSF_pending_request_test_target_ (pr, peer))
298 GSF_pending_request_test_target_ (pr,
299 peer))
300 { 299 {
301 GNUNET_STATISTICS_update (GSF_stats, 300 GNUNET_STATISTICS_update (GSF_stats,
302 gettext_noop ("# Loopback routes suppressed"), 1, 301 gettext_noop ("# Loopback routes suppressed"), 1,
303 GNUNET_NO); 302 GNUNET_NO);
304 return; 303 return;
305 } 304 }
306 GSF_plan_add_ (cp, pr); 305 GSF_plan_add_ (cp, pr);
@@ -343,7 +342,7 @@ static int
343handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other, 342handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other,
344 const struct GNUNET_MessageHeader *message, 343 const struct GNUNET_MessageHeader *message,
345 const struct GNUNET_ATS_Information *atsi, 344 const struct GNUNET_ATS_Information *atsi,
346 unsigned int atsi_count) 345 unsigned int atsi_count)
347{ 346{
348 struct GSF_PendingRequest *pr; 347 struct GSF_PendingRequest *pr;
349 348
@@ -475,13 +474,11 @@ consider_peer_for_forwarding (void *cls, const GNUNET_HashCode * key,
475 struct GNUNET_PeerIdentity pid; 474 struct GNUNET_PeerIdentity pid;
476 475
477 GSF_connected_peer_get_identity_ (cp, &pid); 476 GSF_connected_peer_get_identity_ (cp, &pid);
478 if (GNUNET_YES != 477 if (GNUNET_YES != GSF_pending_request_test_target_ (pr, &pid))
479 GSF_pending_request_test_target_ (pr,
480 &pid))
481 { 478 {
482 GNUNET_STATISTICS_update (GSF_stats, 479 GNUNET_STATISTICS_update (GSF_stats,
483 gettext_noop ("# Loopback routes suppressed"), 1, 480 gettext_noop ("# Loopback routes suppressed"), 1,
484 GNUNET_NO); 481 GNUNET_NO);
485 return GNUNET_YES; 482 return GNUNET_YES;
486 } 483 }
487 GSF_plan_add_ (cp, pr); 484 GSF_plan_add_ (cp, pr);
@@ -500,7 +497,7 @@ consider_peer_for_forwarding (void *cls, const GNUNET_HashCode * key,
500static void 497static void
501peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, 498peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
502 const struct GNUNET_ATS_Information *atsi, 499 const struct GNUNET_ATS_Information *atsi,
503 unsigned int atsi_count) 500 unsigned int atsi_count)
504{ 501{
505 struct GSF_ConnectedPeer *cp; 502 struct GSF_ConnectedPeer *cp;
506 503
@@ -568,9 +565,8 @@ main_init (struct GNUNET_SERVER_Handle *server,
568 GSF_core = GNUNET_CORE_connect (GSF_cfg, 2, /* larger? */ 565 GSF_core = GNUNET_CORE_connect (GSF_cfg, 2, /* larger? */
569 NULL, &peer_init_handler, 566 NULL, &peer_init_handler,
570 &peer_connect_handler, 567 &peer_connect_handler,
571 &GSF_peer_disconnect_handler_, 568 &GSF_peer_disconnect_handler_, NULL,
572 NULL, GNUNET_NO, 569 GNUNET_NO, NULL, GNUNET_NO, p2p_handlers);
573 NULL, GNUNET_NO, p2p_handlers);
574 if (NULL == GSF_core) 570 if (NULL == GSF_core)
575 { 571 {
576 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 572 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,