aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_quota_compliance.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-06-05 13:07:13 +0000
committerChristian Grothoff <christian@grothoff.org>2011-06-05 13:07:13 +0000
commit187f3ee1b6edac986b7bc46c62c86a138290b147 (patch)
tree809c2751509e7111ad26e802e5df8d2332c24455 /src/transport/test_quota_compliance.c
parent2850662595ec7d25aaaf9674e987449375960c23 (diff)
downloadgnunet-187f3ee1b6edac986b7bc46c62c86a138290b147.tar.gz
gnunet-187f3ee1b6edac986b7bc46c62c86a138290b147.zip
adapting testcases to use new API
Diffstat (limited to 'src/transport/test_quota_compliance.c')
-rw-r--r--src/transport/test_quota_compliance.c716
1 files changed, 381 insertions, 335 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 1f4d21fc8..48a78f19d 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -146,6 +146,7 @@ static int is_asymmetric_recv_constant;
146static struct GNUNET_TIME_Absolute start_time; 146static struct GNUNET_TIME_Absolute start_time;
147 147
148static GNUNET_SCHEDULER_TaskIdentifier die_task; 148static GNUNET_SCHEDULER_TaskIdentifier die_task;
149static GNUNET_SCHEDULER_TaskIdentifier tct;
149static GNUNET_SCHEDULER_TaskIdentifier measurement_task; 150static GNUNET_SCHEDULER_TaskIdentifier measurement_task;
150static GNUNET_SCHEDULER_TaskIdentifier measurement_counter_task; 151static GNUNET_SCHEDULER_TaskIdentifier measurement_counter_task;
151 152
@@ -154,33 +155,27 @@ static struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle;
154#define OKPP do { ok++; } while (0) 155#define OKPP do { ok++; } while (0)
155 156
156 157
157
158static void
159end_send ()
160{
161
162}
163
164static void 158static void
165end () 159end ()
166{ 160{
167 GNUNET_SCHEDULER_cancel (die_task); 161 GNUNET_SCHEDULER_cancel (die_task);
168 die_task = GNUNET_SCHEDULER_NO_TASK; 162 die_task = GNUNET_SCHEDULER_NO_TASK;
169 163
170 if (measurement_task != GNUNET_SCHEDULER_NO_TASK) 164 if (measurement_task != GNUNET_SCHEDULER_NO_TASK)
171 { 165 {
172 GNUNET_SCHEDULER_cancel (measurement_task); 166 GNUNET_SCHEDULER_cancel (measurement_task);
173 measurement_task = GNUNET_SCHEDULER_NO_TASK; 167 measurement_task = GNUNET_SCHEDULER_NO_TASK;
174 } 168 }
175 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) 169 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK)
176 { 170 {
177 GNUNET_SCHEDULER_cancel (measurement_counter_task); 171 GNUNET_SCHEDULER_cancel (measurement_counter_task);
178 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; 172 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
179 } 173 }
180 fprintf(stderr,"\n"); 174 fprintf(stderr,"\n");
181 GNUNET_SCHEDULER_shutdown (); 175 GNUNET_SCHEDULER_shutdown ();
182#if DEBUG_CONNECTIONS 176#if DEBUG_CONNECTIONS
183 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); 177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
178 "Disconnecting from transports!\n");
184#endif 179#endif
185 GNUNET_TRANSPORT_disconnect (p1.th); 180 GNUNET_TRANSPORT_disconnect (p1.th);
186 GNUNET_TRANSPORT_disconnect (p2.th); 181 GNUNET_TRANSPORT_disconnect (p2.th);
@@ -213,19 +208,24 @@ end_badly (void *cls,
213{ 208{
214 if (measurement_task != GNUNET_SCHEDULER_NO_TASK) 209 if (measurement_task != GNUNET_SCHEDULER_NO_TASK)
215 { 210 {
216 GNUNET_SCHEDULER_cancel (measurement_task); 211 GNUNET_SCHEDULER_cancel (measurement_task);
217 measurement_task = GNUNET_SCHEDULER_NO_TASK; 212 measurement_task = GNUNET_SCHEDULER_NO_TASK;
218 } 213 }
219 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) 214 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK)
220 { 215 {
221 GNUNET_SCHEDULER_cancel (measurement_counter_task); 216 GNUNET_SCHEDULER_cancel (measurement_counter_task);
222 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; 217 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
223 } 218 }
224 GNUNET_break (0); 219 GNUNET_break (0);
220 if (GNUNET_SCHEDULER_NO_TASK != tct)
221 {
222 GNUNET_SCHEDULER_cancel (tct);
223 tct = GNUNET_SCHEDULER_NO_TASK;
224 }
225 if (p1.th != NULL) 225 if (p1.th != NULL)
226 GNUNET_TRANSPORT_disconnect (p1.th); 226 GNUNET_TRANSPORT_disconnect (p1.th);
227 if (p2.th != NULL) 227 if (p2.th != NULL)
228 GNUNET_TRANSPORT_disconnect (p2.th); 228 GNUNET_TRANSPORT_disconnect (p2.th);
229 ok = 1; 229 ok = 1;
230} 230}
231 231
@@ -235,6 +235,7 @@ struct TestMessage
235 uint32_t num; 235 uint32_t num;
236}; 236};
237 237
238
238static unsigned int 239static unsigned int
239get_size () 240get_size ()
240{ 241{
@@ -271,6 +272,7 @@ notify_receive_new (void *cls,
271 last_msg_recv = ntohl (hdr->num); 272 last_msg_recv = ntohl (hdr->num);
272} 273}
273 274
275
274static size_t 276static size_t
275notify_ready (void *cls, size_t size, void *buf) 277notify_ready (void *cls, size_t size, void *buf)
276{ 278{
@@ -280,23 +282,19 @@ notify_ready (void *cls, size_t size, void *buf)
280 unsigned int ret; 282 unsigned int ret;
281 283
282 transmit_handle = NULL; 284 transmit_handle = NULL;
283
284 if (measurement_task == GNUNET_SCHEDULER_NO_TASK) 285 if (measurement_task == GNUNET_SCHEDULER_NO_TASK)
285 return 0; 286 return 0;
286 287
287 if (buf == NULL) 288 if (buf == NULL)
288 { 289 {
289 ok = 42; 290 ok = 42;
290 return 0; 291 return 0;
291 } 292 }
292
293 if (measurement_running != GNUNET_YES) 293 if (measurement_running != GNUNET_YES)
294 { 294 {
295 send_running = GNUNET_NO; 295 send_running = GNUNET_NO;
296 end_send(); 296 return 0;
297 return 0; 297 }
298 }
299
300 send_running = GNUNET_YES; 298 send_running = GNUNET_YES;
301 ret = 0; 299 ret = 0;
302 s = get_size (); 300 s = get_size ();
@@ -338,26 +336,28 @@ notify_ready (void *cls, size_t size, void *buf)
338 return ret; 336 return ret;
339} 337}
340 338
341static void measure (unsigned long long quota_p1, unsigned long long quota_p2 );
342 339
343static void measurement_counter 340static void
344 (void *cls, 341measure (unsigned long long quota_p1, unsigned long long quota_p2);
345 const struct GNUNET_SCHEDULER_TaskContext *tc) 342
343static void
344measurement_counter (void *cls,
345 const struct GNUNET_SCHEDULER_TaskContext *tc)
346{ 346{
347 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; 347 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
348
349 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 348 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
350 return; 349 return;
351 350
352 fprintf(stderr,"."); 351 fprintf(stderr,".");
353 measurement_counter_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 352 measurement_counter_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
354 &measurement_counter, 353 &measurement_counter,
355 NULL); 354 NULL);
356} 355}
357 356
357
358static void 358static void
359measurement_end (void *cls, 359measurement_end (void *cls,
360 const struct GNUNET_SCHEDULER_TaskContext *tc) 360 const struct GNUNET_SCHEDULER_TaskContext *tc)
361{ 361{
362 static int strike_counter; 362 static int strike_counter;
363 static int failed_measurement_counter = 1; 363 static int failed_measurement_counter = 1;
@@ -366,219 +366,275 @@ measurement_end (void *cls,
366 366
367 measurement_task = GNUNET_SCHEDULER_NO_TASK; 367 measurement_task = GNUNET_SCHEDULER_NO_TASK;
368 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 368 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
369 return; 369 return;
370 370
371 measurement_running = GNUNET_NO; 371 measurement_running = GNUNET_NO;
372 struct GNUNET_TIME_Relative duration = GNUNET_TIME_absolute_get_difference(start_time, GNUNET_TIME_absolute_get()); 372 struct GNUNET_TIME_Relative duration
373 = GNUNET_TIME_absolute_get_difference(start_time, GNUNET_TIME_absolute_get());
373 374
374 375
375 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) 376 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK)
376 { 377 {
377 GNUNET_SCHEDULER_cancel (measurement_counter_task); 378 GNUNET_SCHEDULER_cancel (measurement_counter_task);
378 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; 379 measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
379 } 380 }
380 381
381 if (transmit_handle != NULL) 382 if (transmit_handle != NULL)
382 { 383 {
383 GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle); 384 GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle);
384 transmit_handle = NULL; 385 transmit_handle = NULL;
385 } 386 }
386 387
387 if (current_quota_p1 < current_quota_p2) 388 if (current_quota_p1 < current_quota_p2)
388 quota_allowed = current_quota_p1; 389 quota_allowed = current_quota_p1;
389 else 390 else
390 quota_allowed = current_quota_p2; 391 quota_allowed = current_quota_p2;
391 392
392 393
393 if (MEASUREMENT_SOFT_LIMIT > (quota_allowed/3)) 394 if (MEASUREMENT_SOFT_LIMIT > (quota_allowed/3))
394 delta = MEASUREMENT_SOFT_LIMIT; 395 delta = MEASUREMENT_SOFT_LIMIT;
395 else 396 else
396 delta = (quota_allowed/3); 397 delta = (quota_allowed/3);
397 398
398 /* Throughput is far too slow. This is to prevent the test to exit with success when throughput is 0 */ 399 /* Throughput is far too slow. This is to prevent the test to exit with success when throughput is 0 */
399 if ((total_bytes_sent/(duration.rel_value / 1000)) < 100) 400 if ((total_bytes_sent/(duration.rel_value / 1000)) < 100)
400 { 401 {
402 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
403 "\nQuota compliance failed: \n" \
404 "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n" \
405 "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n" \
406 "Throughput : %10llu kB/s (%llu B/s)\n",
407 (quota_allowed / (1024)), quota_allowed,
408 ((quota_allowed+delta) / (1024)), quota_allowed+delta,
409 (total_bytes_sent/(duration.rel_value / 1000)/1024),
410 total_bytes_sent/(duration.rel_value / 1000));
411 ok = 1;
412 failed_measurement_counter--;
413 if (failed_measurement_counter < 0)
414 {
401 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 415 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
402 "\nQuota compliance failed: \n"\ 416 "\nQuota measurement failed and no free strike: %i\n",
403 "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n"\ 417 failed_measurement_counter);
404 "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n"\ 418 end();
405 "Throughput : %10llu kB/s (%llu B/s)\n", 419 return;
406 (quota_allowed / (1024)), quota_allowed, 420 }
407 ((quota_allowed+delta) / (1024)), quota_allowed+delta, 421 else
408 (total_bytes_sent/(duration.rel_value / 1000)/1024), 422 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
409 total_bytes_sent/(duration.rel_value / 1000)); 423 "\nQuota measurement failed and %i free strikes\n",
410 ok = 1; 424 failed_measurement_counter);
411 failed_measurement_counter--; 425 }
412 if (failed_measurement_counter < 0) 426
413 {
414 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
415 "\nQuota measurement failed and no free strike: %i\n",failed_measurement_counter);
416 end();
417 return;
418 }
419 else
420 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
421 "\nQuota measurement failed and %i free strikes\n",failed_measurement_counter);
422 }
423
424 /* Throughput is bigger than allowed quota + some extra*/ 427 /* Throughput is bigger than allowed quota + some extra*/
425 if ((total_bytes_sent/(duration.rel_value / 1000)) > (quota_allowed + delta)) 428 if ((total_bytes_sent/(duration.rel_value / 1000)) > (quota_allowed + delta))
426 { 429 {
430 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
431 "\nQuota compliance failed: \n" \
432 "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n" \
433 "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n" \
434 "Throughput : %10llu kB/s (%llu B/s)\n",
435 (quota_allowed / (1024)), quota_allowed,
436 ((quota_allowed+delta) / (1024)), quota_allowed+delta,
437 (total_bytes_sent/(duration.rel_value / 1000)/1024),
438 total_bytes_sent/(duration.rel_value / 1000));
439 ok = 1;
440 failed_measurement_counter--;
441 if (failed_measurement_counter < 0)
442 {
427 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 443 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
428 "\nQuota compliance failed: \n"\ 444 "\nQuota measurement failed and no free strike: %i\n",failed_measurement_counter);
429 "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n"\ 445 end();
430 "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n"\ 446 return;
431 "Throughput : %10llu kB/s (%llu B/s)\n", 447 }
432 (quota_allowed / (1024)), quota_allowed, 448 else
433 ((quota_allowed+delta) / (1024)), quota_allowed+delta, 449 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
434 (total_bytes_sent/(duration.rel_value / 1000)/1024), 450 "\nQuota measurement failed and %i free strikes\n",failed_measurement_counter);
435 total_bytes_sent/(duration.rel_value / 1000)); 451 }
436 ok = 1;
437 failed_measurement_counter--;
438 if (failed_measurement_counter < 0)
439 {
440 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
441 "\nQuota measurement failed and no free strike: %i\n",failed_measurement_counter);
442 end();
443 return;
444 }
445 else
446 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
447 "\nQuota measurement failed and %i free strikes\n",failed_measurement_counter);
448 }
449 else 452 else
450 { 453 {
451 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 454 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
452 "\nQuota compliance ok: \n"\ 455 "\nQuota compliance ok: \n" \
453 "Quota allowed: %10llu kB/s\n"\ 456 "Quota allowed: %10llu kB/s\n" \
454 "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes_sent/(duration.rel_value / 1000)/1024)); 457 "Throughput : %10llu kB/s\n",
455 if (failed_measurement_counter < 2) 458 (quota_allowed / (1024)),
456 failed_measurement_counter++; 459 (total_bytes_sent/(duration.rel_value / 1000)/1024));
457 ok = 0; 460 if (failed_measurement_counter < 2)
458 } 461 failed_measurement_counter++;
459 462 ok = 0;
463 }
464
460 if ((quota_allowed) > (2 *(total_bytes_sent/(duration.rel_value / 1000)))) 465 if ((quota_allowed) > (2 *(total_bytes_sent/(duration.rel_value / 1000))))
461 { 466 {
462 if (failed_measurement_counter < 2) 467 if (failed_measurement_counter < 2)
463 failed_measurement_counter++; 468 failed_measurement_counter++;
464 if (strike_counter == 2) 469 if (strike_counter == 2)
465 { 470 {
466 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 471 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
467 "Maximum transmission rate reached, stopping test\n"); 472 "Maximum transmission rate reached, stopping test\n");
468 end();
469 return;
470 }
471 }
472 else
473 {
474 strike_counter = 0;
475 }
476
477 if (quota_allowed == MEASUREMENT_MAX_QUOTA)
478 {
479 end(); 473 end();
480 return; 474 return;
481 } 475 }
476 }
477 else
478 {
479 strike_counter = 0;
480 }
481
482 if (quota_allowed == MEASUREMENT_MAX_QUOTA)
483 {
484 end();
485 return;
486 }
482 if (is_asymmetric_send_constant == GNUNET_YES) 487 if (is_asymmetric_send_constant == GNUNET_YES)
483 { 488 {
484 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) 489 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA)
485 measure (current_quota_p1 * 2, MEASUREMENT_MAX_QUOTA); 490 measure (current_quota_p1 * 2, MEASUREMENT_MAX_QUOTA);
486 else 491 else
487 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA); 492 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA);
488 } 493 }
489 else if (is_asymmetric_recv_constant == GNUNET_YES) 494 else if (is_asymmetric_recv_constant == GNUNET_YES)
490 { 495 {
491 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) 496 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA)
492 measure (MEASUREMENT_MAX_QUOTA, current_quota_p2 * 2); 497 measure (MEASUREMENT_MAX_QUOTA, current_quota_p2 * 2);
493 else 498 else
494 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA); 499 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA);
495 } 500 }
496 else 501 else
497 { 502 {
498 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) 503 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA)
499 measure ((current_quota_p1) * 2, (current_quota_p2) * 2); 504 measure ((current_quota_p1) * 2, (current_quota_p2) * 2);
500 else 505 else
501 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA); 506 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA);
502 } 507 }
503} 508}
504 509
505static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) 510static void
511measure (unsigned long long quota_p1, unsigned long long quota_p2)
506{ 512{
507 current_quota_p1 = quota_p1; 513 current_quota_p1 = quota_p1;
508 current_quota_p2 = quota_p2; 514 current_quota_p2 = quota_p2;
509#if VERBOSE 515#if VERBOSE
510 if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES)) 516 if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES))
511 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
512 "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); 518 "Starting transport level measurement for %u seconds, receiving peer quota %llu kB/s, sending peer quota %llu kB/s\n",
519 MEASUREMENT_INTERVALL.rel_value / 1000 ,
520 current_quota_p1 / 1024,
521 current_quota_p2 / 1024);
513 else 522 else
514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 523 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
515 "Starting transport level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2 / 1024); 524 "Starting transport level measurement for %u seconds, symmetric quota %llu kB/s\n",
516 525 MEASUREMENT_INTERVALL.rel_value / 1000,
526 current_quota_p2 / 1024);
527
517#endif 528#endif
518 GNUNET_TRANSPORT_set_quota (p1.th, 529 GNUNET_TRANSPORT_set_quota (p1.th,
519 &p2.id, 530 &p2.id,
520 GNUNET_BANDWIDTH_value_init (current_quota_p1), 531 GNUNET_BANDWIDTH_value_init (current_quota_p1),
521 GNUNET_BANDWIDTH_value_init (current_quota_p1)); 532 GNUNET_BANDWIDTH_value_init (current_quota_p1));
522 GNUNET_TRANSPORT_set_quota (p2.th, 533 GNUNET_TRANSPORT_set_quota (p2.th,
523 &p1.id, 534 &p1.id,
524 GNUNET_BANDWIDTH_value_init (current_quota_p2), 535 GNUNET_BANDWIDTH_value_init (current_quota_p2),
525 GNUNET_BANDWIDTH_value_init (current_quota_p2)); 536 GNUNET_BANDWIDTH_value_init (current_quota_p2));
526 GNUNET_SCHEDULER_cancel (die_task); 537 GNUNET_SCHEDULER_cancel (die_task);
527 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 538 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
528 &end_badly, 539 &end_badly,
529 NULL); 540 NULL);
530 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) 541 if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK)
531 GNUNET_SCHEDULER_cancel (measurement_counter_task); 542 GNUNET_SCHEDULER_cancel (measurement_counter_task);
532 measurement_counter_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 543 measurement_counter_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
533 &measurement_counter, 544 &measurement_counter,
534 NULL); 545 NULL);
535 measurement_task = GNUNET_SCHEDULER_add_delayed (MEASUREMENT_INTERVALL, 546 measurement_task = GNUNET_SCHEDULER_add_delayed (MEASUREMENT_INTERVALL,
536 &measurement_end, 547 &measurement_end,
537 NULL); 548 NULL);
538 total_bytes_sent = 0; 549 total_bytes_sent = 0;
539 last_msg_sent = 0; 550 last_msg_sent = 0;
540 last_msg_recv = 0; 551 last_msg_recv = 0;
541 measurement_running = GNUNET_YES; 552 measurement_running = GNUNET_YES;
542 start_time = GNUNET_TIME_absolute_get (); 553 start_time = GNUNET_TIME_absolute_get ();
543 554
544 if (transmit_handle != NULL) 555 if (transmit_handle != NULL)
545 GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle); 556 GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle);
546 transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, 557 transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th,
547 &p1.id, 558 &p1.id,
548 get_size (), 0, SEND_TIMEOUT, 559 get_size (), 0, SEND_TIMEOUT,
549 &notify_ready, 560 &notify_ready,
550 NULL); 561 NULL);
562}
563
564
565static void
566exchange_hello_last (void *cls,
567 const struct GNUNET_MessageHeader *message)
568{
569 struct PeerContext *me = cls;
570
571 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
572 "Exchanging HELLO of size %d with peer (%s)!\n",
573 (int) GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message),
574 GNUNET_i2s (&me->id));
575 GNUNET_assert (message != NULL);
576 GNUNET_assert (GNUNET_OK ==
577 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *)
578 message, &me->id));
579 GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL);
580}
581
582
583
584static void
585exchange_hello (void *cls,
586 const struct GNUNET_MessageHeader *message)
587{
588 struct PeerContext *me = cls;
589
590 GNUNET_assert (message != NULL);
591 GNUNET_assert (GNUNET_OK ==
592 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *)
593 message, &me->id));
594 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
595 "Exchanging HELLO of size %d from peer %s!\n",
596 (int) GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message),
597 GNUNET_i2s (&me->id));
598 GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
551} 599}
552 600
601
553static void 602static void
554notify_connect (void *cls, 603notify_connect (void *cls,
555 const struct GNUNET_PeerIdentity *peer, 604 const struct GNUNET_PeerIdentity *peer,
556 const struct GNUNET_TRANSPORT_ATS_Information *ats, uint32_t ats_count) 605 const struct GNUNET_TRANSPORT_ATS_Information *ats, uint32_t ats_count)
557{ 606{
558 if (cls == &p1) 607 connected++;
608 if (cls == &p1)
559 { 609 {
560#if DEBUG_CONNECTIONS 610#if DEBUG_CONNECTIONS
561 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 611 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
562 "Peer 1 `%4s' connected to us (%p)!\n", GNUNET_i2s (peer), cls); 612 "Peer 1 `%4s' connected to us (%p)!\n",
613 GNUNET_i2s (peer),
614 cls);
563#endif 615#endif
564 connected++;
565 } 616 }
566 else 617 else
567 { 618 {
568#if DEBUG_CONNECTIONS 619#if DEBUG_CONNECTIONS
569 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
570 "Peer 2 `%4s' connected to us (%p)!\n", GNUNET_i2s (peer), cls); 621 "Peer 2 `%4s' connected to us (%p)!\n",
622 GNUNET_i2s (peer),
623 cls);
571#endif 624#endif
572 connected++;
573 } 625 }
574 if (connected == 2) 626 if (connected == 2)
575 { 627 {
576 if (is_asymmetric_send_constant == GNUNET_YES) 628 GNUNET_SCHEDULER_cancel (tct);
577 measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MAX_QUOTA); 629 tct = GNUNET_SCHEDULER_NO_TASK;
578 else if (is_asymmetric_recv_constant == GNUNET_YES) 630 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2);
579 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MIN_QUOTA); 631 GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1);
580 else 632 if (is_asymmetric_send_constant == GNUNET_YES)
581 measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MIN_QUOTA); 633 measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MAX_QUOTA);
634 else if (is_asymmetric_recv_constant == GNUNET_YES)
635 measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MIN_QUOTA);
636 else
637 measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MIN_QUOTA);
582 } 638 }
583} 639}
584 640
@@ -586,6 +642,7 @@ notify_connect (void *cls,
586static void 642static void
587notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) 643notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
588{ 644{
645 connected--;
589#if DEBUG_CONNECTIONS 646#if DEBUG_CONNECTIONS
590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 647 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
591 "Peer `%4s' disconnected (%p)!\n", 648 "Peer `%4s' disconnected (%p)!\n",
@@ -617,56 +674,24 @@ setup_peer (struct PeerContext *p, const char *cfgname)
617 GNUNET_assert (p->th != NULL); 674 GNUNET_assert (p->th != NULL);
618} 675}
619 676
620static size_t
621notify_ready_connect (void *cls, size_t size, void *buf)
622{
623 return 0;
624}
625 677
626static void 678static void
627exchange_hello_last (void *cls, 679try_connect (void *cls,
628 const struct GNUNET_MessageHeader *message) 680 const struct GNUNET_SCHEDULER_TaskContext *tc)
629{ 681{
630 struct PeerContext *me = cls; 682 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
631 683 "Asking peers to connect...\n");
632 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, me); 684 GNUNET_TRANSPORT_try_connect (p2.th,
633 685 &p1.id);
634 GNUNET_assert (ok >= 3); 686 GNUNET_TRANSPORT_try_connect (p1.th,
635 OKPP; 687 &p2.id);
636 GNUNET_assert (message != NULL); 688 tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
637 GNUNET_assert (GNUNET_OK == 689 &try_connect,
638 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) 690 NULL);
639 message, &me->id));
640
641 GNUNET_assert(NULL != (transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th,
642 &p1.id,
643 sizeof (struct GNUNET_MessageHeader), 0,
644 TIMEOUT,
645 &notify_ready_connect,
646 NULL)));
647
648 /* both HELLOs exchanged, get ready to test transmission! */
649} 691}
650 692
651 693
652static void 694static void
653exchange_hello (void *cls,
654 const struct GNUNET_MessageHeader *message)
655{
656 struct PeerContext *me = cls;
657
658 GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, me);
659 GNUNET_assert (ok >= 2);
660 OKPP;
661 GNUNET_assert (message != NULL);
662 GNUNET_assert (GNUNET_OK ==
663 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *)
664 message, &me->id));
665 GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
666 GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2);
667}
668
669static void
670run (void *cls, 695run (void *cls,
671 char *const *args, 696 char *const *args,
672 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) 697 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -683,67 +708,85 @@ run (void *cls,
683 708
684 if (is_tcp) 709 if (is_tcp)
685 { 710 {
686 if (is_asymmetric_recv_constant == GNUNET_YES) 711 if (is_asymmetric_recv_constant == GNUNET_YES)
687 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for TCP transport plugin\n"); 712 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
688 else if (is_asymmetric_send_constant == GNUNET_YES) 713 "Testing asymmetric quota compliance (receiver quota constant) for TCP transport plugin\n");
689 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for TCP transport plugin\n"); 714 else if (is_asymmetric_send_constant == GNUNET_YES)
690 else 715 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
691 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for TCP transport plugin\n"); 716 "Testing asymmetric quota compliance (sender quota constant) for TCP transport plugin\n");
717 else
718 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
719 "Testing symmetric quota compliance for TCP transport plugin\n");
692 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf"); 720 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf");
693 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf"); 721 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf");
694 } 722 }
695 else if (is_http) 723 else if (is_http)
696 { 724 {
697 if (is_asymmetric_recv_constant == GNUNET_YES) 725 if (is_asymmetric_recv_constant == GNUNET_YES)
698 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for HTTP transport plugin\n"); 726 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
699 else if (is_asymmetric_send_constant == GNUNET_YES) 727 "Testing asymmetric quota compliance (receiver quota constant) for HTTP transport plugin\n");
700 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for HTTP transport plugin\n"); 728 else if (is_asymmetric_send_constant == GNUNET_YES)
701 else 729 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
702 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for HTTP transport plugin\n"); 730 "Testing asymmetric quota compliance (sender quota constant) for HTTP transport plugin\n");
731 else
732 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
733 "Testing symmetric quota compliance for HTTP transport plugin\n");
703 setup_peer (&p1, "test_quota_compliance_http_peer1.conf"); 734 setup_peer (&p1, "test_quota_compliance_http_peer1.conf");
704 setup_peer (&p2, "test_quota_compliance_http_peer2.conf"); 735 setup_peer (&p2, "test_quota_compliance_http_peer2.conf");
705 } 736 }
706 else if (is_https) 737 else if (is_https)
707 { 738 {
708 if (is_asymmetric_recv_constant == GNUNET_YES) 739 if (is_asymmetric_recv_constant == GNUNET_YES)
709 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for HTTPS transport plugin\n"); 740 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
710 else if (is_asymmetric_send_constant == GNUNET_YES) 741 "Testing asymmetric quota compliance (receiver quota constant) for HTTPS transport plugin\n");
711 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for HTTPS transport plugin\n"); 742 else if (is_asymmetric_send_constant == GNUNET_YES)
712 else 743 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for HTTPS transport plugin\n"); 744 "Testing asymmetric quota compliance (sender quota constant) for HTTPS transport plugin\n");
745 else
746 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
747 "Testing symmetric quota compliance for HTTPS transport plugin\n");
714 setup_peer (&p1, "test_quota_compliance_https_peer1.conf"); 748 setup_peer (&p1, "test_quota_compliance_https_peer1.conf");
715 setup_peer (&p2, "test_quota_compliance_https_peer2.conf"); 749 setup_peer (&p2, "test_quota_compliance_https_peer2.conf");
716 } 750 }
717 else if (is_udp) 751 else if (is_udp)
718 { 752 {
719 if (is_asymmetric_recv_constant == GNUNET_YES) 753 if (is_asymmetric_recv_constant == GNUNET_YES)
720 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for UDP transport plugin\n"); 754 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
721 else if (is_asymmetric_send_constant == GNUNET_YES) 755 "Testing asymmetric quota compliance (receiver quota constant) for UDP transport plugin\n");
722 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for UDP transport plugin\n"); 756 else if (is_asymmetric_send_constant == GNUNET_YES)
723 else 757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
724 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for UDP transport plugin\n"); 758 "Testing asymmetric quota compliance (sender quota constant) for UDP transport plugin\n");
759 else
760 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
761 "Testing symmetric quota compliance for UDP transport plugin\n");
725 setup_peer (&p1, "test_quota_compliance_udp_peer1.conf"); 762 setup_peer (&p1, "test_quota_compliance_udp_peer1.conf");
726 setup_peer (&p2, "test_quota_compliance_udp_peer2.conf"); 763 setup_peer (&p2, "test_quota_compliance_udp_peer2.conf");
727 } 764 }
728 else if (is_unix) 765 else if (is_unix)
729 { 766 {
730 if (is_asymmetric_recv_constant == GNUNET_YES) 767 if (is_asymmetric_recv_constant == GNUNET_YES)
731 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for UNIX transport plugin\n"); 768 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
732 else if (is_asymmetric_send_constant == GNUNET_YES) 769 "Testing asymmetric quota compliance (receiver quota constant) for UNIX transport plugin\n");
733 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for UNIX transport plugin\n"); 770 else if (is_asymmetric_send_constant == GNUNET_YES)
734 else 771 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
735 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for UNIX transport plugin\n"); 772 "Testing asymmetric quota compliance (sender quota constant) for UNIX transport plugin\n");
773 else
774 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
775 "Testing symmetric quota compliance for UNIX transport plugin\n");
736 setup_peer (&p1, "test_quota_compliance_unix_peer1.conf"); 776 setup_peer (&p1, "test_quota_compliance_unix_peer1.conf");
737 setup_peer (&p2, "test_quota_compliance_unix_peer2.conf"); 777 setup_peer (&p2, "test_quota_compliance_unix_peer2.conf");
738 } 778 }
739 else if (is_tcp_nat) 779 else if (is_tcp_nat)
740 { 780 {
741 if (is_asymmetric_recv_constant == GNUNET_YES) 781 if (is_asymmetric_recv_constant == GNUNET_YES)
742 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for TCP NAT transport plugin\n"); 782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
743 else if (is_asymmetric_send_constant == GNUNET_YES) 783 "Testing asymmetric quota compliance (receiver quota constant) for TCP NAT transport plugin\n");
744 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for TCP NAT transport plugin\n"); 784 else if (is_asymmetric_send_constant == GNUNET_YES)
745 else 785 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
746 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for TCP NAT transport plugin\n"); 786 "Testing asymmetric quota compliance (sender quota constant) for TCP NAT transport plugin\n");
787 else
788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
789 "Testing symmetric quota compliance for TCP NAT transport plugin\n");
747 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf"); 790 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf");
748 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf"); 791 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf");
749 } 792 }
@@ -753,8 +796,11 @@ run (void *cls,
753 GNUNET_assert(p1.th != NULL); 796 GNUNET_assert(p1.th != NULL);
754 GNUNET_assert(p2.th != NULL); 797 GNUNET_assert(p2.th != NULL);
755 GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); 798 GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1);
799 GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2);
800 tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL);
756} 801}
757 802
803
758int 804int
759main (int argc, char *argv[]) 805main (int argc, char *argv[])
760{ 806{
@@ -789,67 +835,67 @@ main (int argc, char *argv[])
789 835
790 if (strstr(argv[0], "asymmetric_recv") != NULL) 836 if (strstr(argv[0], "asymmetric_recv") != NULL)
791 { 837 {
792 is_asymmetric_recv_constant = GNUNET_YES; 838 is_asymmetric_recv_constant = GNUNET_YES;
793 } 839 }
794 else 840 else
795 is_asymmetric_recv_constant = GNUNET_NO; 841 is_asymmetric_recv_constant = GNUNET_NO;
796 if (strstr(argv[0], "asymmetric_send") != NULL) 842 if (strstr(argv[0], "asymmetric_send") != NULL)
797 { 843 {
798 is_asymmetric_send_constant = GNUNET_YES; 844 is_asymmetric_send_constant = GNUNET_YES;
799 } 845 }
800 else 846 else
801 is_asymmetric_send_constant = GNUNET_NO; 847 is_asymmetric_send_constant = GNUNET_NO;
802 848
803 char * logger; 849 char * logger;
804 if (is_tcp == GNUNET_YES) 850 if (is_tcp == GNUNET_YES)
805 { 851 {
806 if (is_asymmetric_recv_constant == GNUNET_YES) 852 if (is_asymmetric_recv_constant == GNUNET_YES)
807 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_recv_constant"); 853 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_recv_constant");
808 else if (is_asymmetric_send_constant == GNUNET_YES) 854 else if (is_asymmetric_send_constant == GNUNET_YES)
809 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_send_constant"); 855 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","asymmetric_send_constant");
810 else 856 else
811 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","symmetric"); 857 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","tcp","symmetric");
812 } 858 }
813 else if (is_udp == GNUNET_YES) 859 else if (is_udp == GNUNET_YES)
814 { 860 {
815 if (is_asymmetric_recv_constant == GNUNET_YES) 861 if (is_asymmetric_recv_constant == GNUNET_YES)
816 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_recv_constant"); 862 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_recv_constant");
817 else if (is_asymmetric_send_constant == GNUNET_YES) 863 else if (is_asymmetric_send_constant == GNUNET_YES)
818 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_send_constant"); 864 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","asymmetric_send_constant");
819 else 865 else
820 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","symmetric"); 866 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","udp","symmetric");
821 } 867 }
822 else if (is_unix == GNUNET_YES) 868 else if (is_unix == GNUNET_YES)
823 { 869 {
824 if (is_asymmetric_recv_constant == GNUNET_YES) 870 if (is_asymmetric_recv_constant == GNUNET_YES)
825 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","unix","asymmetric_recv_constant"); 871 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","unix","asymmetric_recv_constant");
826 else if (is_asymmetric_send_constant == GNUNET_YES) 872 else if (is_asymmetric_send_constant == GNUNET_YES)
827 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","unix","asymmetric_send_constant"); 873 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","unix","asymmetric_send_constant");
828 else 874 else
829 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","unix","symmetric"); 875 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","unix","symmetric");
830 } 876 }
831 else if (is_http == GNUNET_YES) 877 else if (is_http == GNUNET_YES)
832 { 878 {
833 if (is_asymmetric_recv_constant == GNUNET_YES) 879 if (is_asymmetric_recv_constant == GNUNET_YES)
834 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_recv_constant"); 880 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_recv_constant");
835 else if (is_asymmetric_send_constant == GNUNET_YES) 881 else if (is_asymmetric_send_constant == GNUNET_YES)
836 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_send_constant"); 882 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","asymmetric_send_constant");
837 else 883 else
838 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","symmetric"); 884 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","http","symmetric");
839 } 885 }
840 else if (is_https == GNUNET_YES) 886 else if (is_https == GNUNET_YES)
841 { 887 {
842 if (is_asymmetric_recv_constant == GNUNET_YES) 888 if (is_asymmetric_recv_constant == GNUNET_YES)
843 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_recv_constant"); 889 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_recv_constant");
844 else if (is_asymmetric_send_constant == GNUNET_YES) 890 else if (is_asymmetric_send_constant == GNUNET_YES)
845 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_send_constant"); 891 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","asymmetric_send_constant");
846 else 892 else
847 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","symmetric"); 893 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","https","symmetric");
848 } 894 }
849 else 895 else
850 { 896 {
851 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","noplugin","none"); 897 GNUNET_asprintf(&logger, "test-quota-compliance-%s-%s","noplugin","none");
852 } 898 }
853 899
854 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1"); 900 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1");
855 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2"); 901 GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2");