aboutsummaryrefslogtreecommitdiff
path: root/src/core/test_core_quota_compliance.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-11-02 17:19:35 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-11-02 17:19:35 +0000
commita9077a809ddf57ca1d515c30bf9a308684b05b48 (patch)
treeb4d94bc8998b5b1936db4f7f26202f2dc244699e /src/core/test_core_quota_compliance.c
parent2e29eebbea91c5fd93a4dd751d10b3a91ce4f775 (diff)
downloadgnunet-a9077a809ddf57ca1d515c30bf9a308684b05b48.tar.gz
gnunet-a9077a809ddf57ca1d515c30bf9a308684b05b48.zip
Diffstat (limited to 'src/core/test_core_quota_compliance.c')
-rw-r--r--src/core/test_core_quota_compliance.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index f662b19e0..10421349e 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -38,6 +38,7 @@
38#define VERBOSE GNUNET_YES 38#define VERBOSE GNUNET_YES
39 39
40#define START_ARM GNUNET_YES 40#define START_ARM GNUNET_YES
41#define DEBUG_CONNECTIONS GNUNET_YES
41 42
42/** 43/**
43 * Note that this value must not significantly exceed 44 * Note that this value must not significantly exceed
@@ -49,7 +50,7 @@
49#define MEASUREMENT_MSG_SIZE 1024 50#define MEASUREMENT_MSG_SIZE 1024
50#define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024 51#define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024
51#define MEASUREMENT_MIN_QUOTA 1024 52#define MEASUREMENT_MIN_QUOTA 1024
52#define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 53#define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 8)
53 54
54/** 55/**
55 * How long until we give up on transmitting the message? 56 * How long until we give up on transmitting the message?
@@ -236,21 +237,36 @@ transmit_ready (void *cls, size_t size, void *buf);
236 237
237static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) 238static void measure (unsigned long long quota_p1, unsigned long long quota_p2 )
238{ 239{
240
241 current_quota_p1 = quota_p1;
242 current_quota_p2 = quota_p2;
239#if VERBOSE 243#if VERBOSE
240 if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES)) 244 if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES))
241 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
242 "Starting transport level measurement for %u seconds, receiving peer quota %llu kB/s, sending peer quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024, current_quota_p2 / 1024); 246 "Starting core level measurement for %u seconds, receiving peer quota %llu kB/s, sending peer quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024, current_quota_p2 / 1024);
243 else 247 else
244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
245 "Starting transport level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2 / 1024); 249 "Starting core level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2 / 1024);
246 250
247#endif 251#endif
248 252
253 GNUNET_TRANSPORT_set_quota (p1.th,
254 &p2.id,
255 GNUNET_BANDWIDTH_value_init (current_quota_p1 ),
256 GNUNET_BANDWIDTH_value_init (current_quota_p1 ),
257 GNUNET_TIME_UNIT_FOREVER_REL,
258 NULL, NULL);
259 GNUNET_TRANSPORT_set_quota (p2.th,
260 &p1.id,
261 GNUNET_BANDWIDTH_value_init (current_quota_p2),
262 GNUNET_BANDWIDTH_value_init (current_quota_p2),
263 GNUNET_TIME_UNIT_FOREVER_REL,
264 NULL, NULL);
265
249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 266 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
250 "Asking core (1) for transmission to peer `%4s'\n", 267 "Asking core (1) for transmission to peer `%4s'\n",
251 GNUNET_i2s (&p2.id)); 268 GNUNET_i2s (&p2.id));
252 err_task = 269 err_task = GNUNET_SCHEDULER_add_delayed (sched,
253 GNUNET_SCHEDULER_add_delayed (sched,
254 TIMEOUT, 270 TIMEOUT,
255 &terminate_task_error, 271 &terminate_task_error,
256 NULL); 272 NULL);
@@ -260,14 +276,14 @@ static void measure (unsigned long long quota_p1, unsigned long long quota_p2 )
260 NULL); 276 NULL);
261 start_time = GNUNET_TIME_absolute_get (); 277 start_time = GNUNET_TIME_absolute_get ();
262 measurement_running = GNUNET_YES; 278 measurement_running = GNUNET_YES;
263 GNUNET_break (NULL != 279 total_bytes = 0;
264 GNUNET_CORE_notify_transmit_ready (p1.ch, 280 total_bytes_sent = 0;
281 ch = GNUNET_CORE_notify_transmit_ready (p1.ch,
265 0, 282 0,
266 TIMEOUT, 283 TIMEOUT,
267 &p2.id, 284 &p2.id,
268 sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE, 285 sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
269 &transmit_ready, &p1)); 286 &transmit_ready, &p1);
270
271} 287}
272 288
273static int tr_n; 289static int tr_n;