aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-02-09 18:48:10 +0000
committerChristian Grothoff <christian@grothoff.org>2014-02-09 18:48:10 +0000
commite0a17cc294317482060b695b7569d5bdd3b01c2f (patch)
tree1721df5ebbcf7fdfa2a9748a476af3eaf4a1e30c /src/transport/transport_api.c
parent9e9b96a4ad14008284c61b475b0ad783469fb74d (diff)
downloadgnunet-e0a17cc294317482060b695b7569d5bdd3b01c2f.tar.gz
gnunet-e0a17cc294317482060b695b7569d5bdd3b01c2f.zip
implementing #3296
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 8d54c361e..1acf14d41 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -439,6 +439,24 @@ outbound_bw_tracker_update (void *cls)
439 439
440 440
441/** 441/**
442 * Function called by the bandwidth tracker if we have excess
443 * bandwidth.
444 *
445 * @param cls the `struct Neighbour` that has excess bandwidth
446 */
447static void
448notify_excess_cb (void *cls)
449{
450 struct Neighbour *n = cls;
451 struct GNUNET_TRANSPORT_Handle *h = n->h;
452
453 if (NULL != h->neb_cb)
454 h->neb_cb (h->cls,
455 &n->id);
456}
457
458
459/**
442 * Add neighbour to our list 460 * Add neighbour to our list
443 * 461 *
444 * @return NULL if this API is currently disconnecting from the service 462 * @return NULL if this API is currently disconnecting from the service
@@ -457,10 +475,12 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
457 n->h = h; 475 n->h = h;
458 n->is_ready = GNUNET_YES; 476 n->is_ready = GNUNET_YES;
459 n->traffic_overhead = 0; 477 n->traffic_overhead = 0;
460 GNUNET_BANDWIDTH_tracker_init (&n->out_tracker, 478 GNUNET_BANDWIDTH_tracker_init2 (&n->out_tracker,
461 outbound_bw_tracker_update, n, 479 &outbound_bw_tracker_update, n,
462 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, 480 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
463 MAX_BANDWIDTH_CARRY_S); 481 MAX_BANDWIDTH_CARRY_S,
482 &notify_excess_cb,
483 n);
464 GNUNET_assert (GNUNET_OK == 484 GNUNET_assert (GNUNET_OK ==
465 GNUNET_CONTAINER_multipeermap_put (h->neighbours, 485 GNUNET_CONTAINER_multipeermap_put (h->neighbours,
466 &n->id, n, 486 &n->id, n,