aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_quota_compliance.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-12-14 10:37:04 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-12-14 10:37:04 +0000
commit99c2ab83dc36639d4ac9f46ef2362892f35775d9 (patch)
tree66d78754ad7340971cbb6ff7aad52a2347aa9f79 /src/transport/test_quota_compliance.c
parent1bc24dcb3cf15f81a21017d0f210c3e87c21df78 (diff)
downloadgnunet-99c2ab83dc36639d4ac9f46ef2362892f35775d9.tar.gz
gnunet-99c2ab83dc36639d4ac9f46ef2362892f35775d9.zip
added counter to avoid single measurements failing to break the whole test
Diffstat (limited to 'src/transport/test_quota_compliance.c')
-rw-r--r--src/transport/test_quota_compliance.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index e4b728007..56d3cb5a4 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -361,6 +361,7 @@ measurement_end (void *cls,
361 const struct GNUNET_SCHEDULER_TaskContext *tc) 361 const struct GNUNET_SCHEDULER_TaskContext *tc)
362{ 362{
363 static int strike_counter; 363 static int strike_counter;
364 static int failed_measurement_counter;
364 unsigned long long quota_allowed = 0; 365 unsigned long long quota_allowed = 0;
365 int delta = 0; 366 int delta = 0;
366 367
@@ -408,7 +409,10 @@ measurement_end (void *cls,
408 (total_bytes_sent/(duration.rel_value / 1000)/1024), 409 (total_bytes_sent/(duration.rel_value / 1000)/1024),
409 total_bytes_sent/(duration.rel_value / 1000)); 410 total_bytes_sent/(duration.rel_value / 1000));
410 ok = 1; 411 ok = 1;
411 end(); 412 failed_measurement_counter--;
413 if (failed_measurement_counter < 0)
414 end();
415 return;
412 } 416 }
413 417
414 /* Throughput is bigger than allowed quota + some extra*/ 418 /* Throughput is bigger than allowed quota + some extra*/
@@ -424,7 +428,9 @@ measurement_end (void *cls,
424 (total_bytes_sent/(duration.rel_value / 1000)/1024), 428 (total_bytes_sent/(duration.rel_value / 1000)/1024),
425 total_bytes_sent/(duration.rel_value / 1000)); 429 total_bytes_sent/(duration.rel_value / 1000));
426 ok = 1; 430 ok = 1;
427 end(); 431 failed_measurement_counter--;
432 if (failed_measurement_counter < 0)
433 end();
428 return; 434 return;
429 } 435 }
430 else 436 else
@@ -433,12 +439,15 @@ measurement_end (void *cls,
433 "\nQuota compliance ok: \n"\ 439 "\nQuota compliance ok: \n"\
434 "Quota allowed: %10llu kB/s\n"\ 440 "Quota allowed: %10llu kB/s\n"\
435 "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes_sent/(duration.rel_value / 1000)/1024)); 441 "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes_sent/(duration.rel_value / 1000)/1024));
442 if (failed_measurement_counter < 2)
443 failed_measurement_counter++;
436 ok = 0; 444 ok = 0;
437 } 445 }
438 446
439 if ((quota_allowed) > (2 *(total_bytes_sent/(duration.rel_value / 1000)))) 447 if ((quota_allowed) > (2 *(total_bytes_sent/(duration.rel_value / 1000))))
440 { 448 {
441 strike_counter++; 449 if (failed_measurement_counter < 2)
450 failed_measurement_counter++;
442 if (strike_counter == 2) 451 if (strike_counter == 2)
443 { 452 {
444 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 453 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -457,7 +466,6 @@ measurement_end (void *cls,
457 end(); 466 end();
458 return; 467 return;
459 } 468 }
460
461 if (is_asymmetric_send_constant == GNUNET_YES) 469 if (is_asymmetric_send_constant == GNUNET_YES)
462 { 470 {
463 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) 471 if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA)