aboutsummaryrefslogtreecommitdiff
path: root/src/util/bandwidth.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-01-30 14:36:49 +0000
committerChristian Grothoff <christian@grothoff.org>2014-01-30 14:36:49 +0000
commit07600feaf31bf8f62ee407a6173d1ef2c19e4878 (patch)
tree05a63b6e028cd9505c0335a279552445ebdbf48a /src/util/bandwidth.c
parente34f367380ed951b51895e24d99a81a12899278c (diff)
downloadgnunet-07600feaf31bf8f62ee407a6173d1ef2c19e4878.tar.gz
gnunet-07600feaf31bf8f62ee407a6173d1ef2c19e4878.zip
-doxygen
Diffstat (limited to 'src/util/bandwidth.c')
-rw-r--r--src/util/bandwidth.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index f056c1aee..09107963c 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -40,7 +40,8 @@ GNUNET_BANDWIDTH_value_init (uint32_t bytes_per_second)
40{ 40{
41 struct GNUNET_BANDWIDTH_Value32NBO ret; 41 struct GNUNET_BANDWIDTH_Value32NBO ret;
42 42
43 LOG (GNUNET_ERROR_TYPE_DEBUG, "Initializing bandwidth of %u Bps\n", 43 LOG (GNUNET_ERROR_TYPE_DEBUG,
44 "Initializing bandwidth of %u Bps\n",
44 (unsigned int) bytes_per_second); 45 (unsigned int) bytes_per_second);
45 ret.value__ = htonl (bytes_per_second); 46 ret.value__ = htonl (bytes_per_second);
46 return ret; 47 return ret;
@@ -91,7 +92,7 @@ GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO
91 92
92/** 93/**
93 * At the given bandwidth, calculate how long it would take for 94 * At the given bandwidth, calculate how long it would take for
94 * 'size' bytes to be transmitted. 95 * @a size bytes to be transmitted.
95 * 96 *
96 * @param bps bandwidth 97 * @param bps bandwidth
97 * @param size number of bytes we want to have available 98 * @param size number of bytes we want to have available
@@ -202,12 +203,12 @@ update_tracker (struct GNUNET_BANDWIDTH_Tracker *av)
202 * Notify the tracker that a certain number of bytes of bandwidth have 203 * Notify the tracker that a certain number of bytes of bandwidth have
203 * been consumed. Note that it is legal to consume bytes even if not 204 * been consumed. Note that it is legal to consume bytes even if not
204 * enough bandwidth is available (in that case, 205 * enough bandwidth is available (in that case,
205 * GNUNET_BANDWIDTH_tracker_get_delay may return non-zero delay values 206 * #GNUNET_BANDWIDTH_tracker_get_delay may return non-zero delay values
206 * even for a size of zero for a while). 207 * even for a size of zero for a while).
207 * 208 *
208 * @param av tracker to update 209 * @param av tracker to update
209 * @param size number of bytes consumed 210 * @param size number of bytes consumed
210 * @return GNUNET_YES if this consumption is above the limit 211 * @return #GNUNET_YES if this consumption is above the limit
211 */ 212 */
212int 213int
213GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, 214GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av,
@@ -215,7 +216,9 @@ GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av,
215{ 216{
216 int64_t nc; 217 int64_t nc;
217 218
218 LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p consumes %d bytes\n", av, 219 LOG (GNUNET_ERROR_TYPE_DEBUG,
220 "Tracker %p consumes %d bytes\n",
221 av,
219 (int) size); 222 (int) size);
220 if (size > 0) 223 if (size > 0)
221 { 224 {
@@ -293,7 +296,7 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av,
293 * @return number of bytes available for consumption right now 296 * @return number of bytes available for consumption right now
294 */ 297 */
295int64_t 298int64_t
296GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker * av) 299GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker *av)
297{ 300{
298 struct GNUNET_BANDWIDTH_Value32NBO bps; 301 struct GNUNET_BANDWIDTH_Value32NBO bps;
299 uint64_t avail; 302 uint64_t avail;
@@ -321,8 +324,7 @@ GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker * av)
321 */ 324 */
322void 325void
323GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, 326GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av,
324 struct GNUNET_BANDWIDTH_Value32NBO 327 struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit)
325 bytes_per_second_limit)
326{ 328{
327 uint32_t old_limit; 329 uint32_t old_limit;
328 uint32_t new_limit; 330 uint32_t new_limit;