aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorWillow Liquorice <willow@howhill.com>2022-08-26 21:04:25 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-08-30 09:42:06 +0200
commitb738d61690f64783c1907488ee5338f7b0f912ac (patch)
tree3cc9a50faba6bc1498449b8d5b4dfa3fc105424a /src/util
parent95f4b6f7a3686da30ca815f39d9af7810303e0c9 (diff)
downloadgnunet-b738d61690f64783c1907488ee5338f7b0f912ac.tar.gz
gnunet-b738d61690f64783c1907488ee5338f7b0f912ac.zip
-First pass through UTIL bandwidth library
Diffstat (limited to 'src/util')
-rw-r--r--src/util/bandwidth.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index 1f889d678..44caec2fa 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -92,14 +92,6 @@ GNUNET_BANDWIDTH_value_sum (struct GNUNET_BANDWIDTH_Value32NBO b1,
92} 92}
93 93
94 94
95/**
96 * At the given bandwidth, calculate how much traffic will be
97 * available until the given deadline.
98 *
99 * @param bps bandwidth
100 * @param deadline when is the deadline
101 * @return number of bytes available at bps until deadline
102 */
103uint64_t 95uint64_t
104GNUNET_BANDWIDTH_value_get_available_until ( 96GNUNET_BANDWIDTH_value_get_available_until (
105 struct GNUNET_BANDWIDTH_Value32NBO bps, 97 struct GNUNET_BANDWIDTH_Value32NBO bps,
@@ -282,22 +274,6 @@ GNUNET_BANDWIDTH_tracker_init2 (
282} 274}
283 275
284 276
285/**
286 * Initialize bandwidth tracker. Note that in addition to the
287 * 'max_carry_s' limit, we also always allow at least
288 * #GNUNET_MAX_MESSAGE_SIZE to accumulate. So if the
289 * bytes-per-second limit is so small that within 'max_carry_s' not
290 * even #GNUNET_MAX_MESSAGE_SIZE is allowed to accumulate, it is
291 * ignored and replaced by #GNUNET_MAX_MESSAGE_SIZE (which is in
292 * bytes).
293 *
294 * @param av tracker to initialize
295 * @param update_cb callback to notify a client about the tracker being updated
296 * @param update_cb_cls cls for the callback
297 * @param bytes_per_second_limit initial limit to assume
298 * @param max_carry_s maximum number of seconds unused bandwidth
299 * may accumulate before it expires
300 */
301void 277void
302GNUNET_BANDWIDTH_tracker_init ( 278GNUNET_BANDWIDTH_tracker_init (
303 struct GNUNET_BANDWIDTH_Tracker *av, 279 struct GNUNET_BANDWIDTH_Tracker *av,
@@ -387,17 +363,6 @@ update_tracker (struct GNUNET_BANDWIDTH_Tracker *av)
387} 363}
388 364
389 365
390/**
391 * Notify the tracker that a certain number of bytes of bandwidth have
392 * been consumed. Note that it is legal to consume bytes even if not
393 * enough bandwidth is available (in that case,
394 * #GNUNET_BANDWIDTH_tracker_get_delay may return non-zero delay values
395 * even for a size of zero for a while).
396 *
397 * @param av tracker to update
398 * @param size number of bytes consumed
399 * @return #GNUNET_YES if this consumption is above the limit
400 */
401int 366int
402GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, 367GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av,
403 ssize_t size) 368 ssize_t size)