gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32264 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r32264 - gnunet/src/transport
Date: Sun, 9 Feb 2014 19:48:10 +0100

Author: grothoff
Date: 2014-02-09 19:48:10 +0100 (Sun, 09 Feb 2014)
New Revision: 32264

Modified:
   gnunet/src/transport/transport_api.c
Log:
implementing #3296

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2014-02-09 18:45:18 UTC (rev 
32263)
+++ gnunet/src/transport/transport_api.c        2014-02-09 18:48:10 UTC (rev 
32264)
@@ -439,6 +439,24 @@
 
 
 /**
+ * Function called by the bandwidth tracker if we have excess
+ * bandwidth.
+ *
+ * @param cls the `struct Neighbour` that has excess bandwidth
+ */
+static void
+notify_excess_cb (void *cls)
+{
+  struct Neighbour *n = cls;
+  struct GNUNET_TRANSPORT_Handle *h = n->h;
+
+  if (NULL != h->neb_cb)
+    h->neb_cb (h->cls,
+               &n->id);
+}
+
+
+/**
  * Add neighbour to our list
  *
  * @return NULL if this API is currently disconnecting from the service
@@ -457,10 +475,12 @@
   n->h = h;
   n->is_ready = GNUNET_YES;
   n->traffic_overhead = 0;
-  GNUNET_BANDWIDTH_tracker_init (&n->out_tracker,
-                                 outbound_bw_tracker_update, n,
-                                 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
-                                 MAX_BANDWIDTH_CARRY_S);
+  GNUNET_BANDWIDTH_tracker_init2 (&n->out_tracker,
+                                  &outbound_bw_tracker_update, n,
+                                  GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
+                                  MAX_BANDWIDTH_CARRY_S,
+                                  &notify_excess_cb,
+                                  n);
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONTAINER_multipeermap_put (h->neighbours,
                                                     &n->id, n,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]