diff options
Diffstat (limited to 'src/transport/test_quota_compliance.c')
-rw-r--r-- | src/transport/test_quota_compliance.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index d7f549b2d..1e0a1ad42 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -45,8 +45,8 @@ | |||
45 | #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) | 45 | #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) |
46 | #define MEASUREMENT_MSG_SIZE 10000 | 46 | #define MEASUREMENT_MSG_SIZE 10000 |
47 | #define MEASUREMENT_MSG_SIZE_BIG 32768 | 47 | #define MEASUREMENT_MSG_SIZE_BIG 32768 |
48 | #define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024 | 48 | #define MEASUREMENT_MAX_QUOTA 10000 |
49 | #define MEASUREMENT_MIN_QUOTA 1024 * 10 | 49 | #define MEASUREMENT_MIN_QUOTA 1024 |
50 | #define SEND_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 35) | 50 | #define SEND_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 35) |
51 | /** | 51 | /** |
52 | * Testcase timeout | 52 | * Testcase timeout |
@@ -394,7 +394,6 @@ measurement_end (void *cls, | |||
394 | } | 394 | } |
395 | else | 395 | else |
396 | { | 396 | { |
397 | |||
398 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 397 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
399 | "\nQuota compliance ok: \n"\ | 398 | "\nQuota compliance ok: \n"\ |
400 | "Quota allowed: %10llu kB/s\n"\ | 399 | "Quota allowed: %10llu kB/s\n"\ |
@@ -402,19 +401,31 @@ measurement_end (void *cls, | |||
402 | ok = 0; | 401 | ok = 0; |
403 | } | 402 | } |
404 | 403 | ||
405 | if (quota_allowed < MEASUREMENT_MIN_QUOTA) | 404 | if (quota_allowed == MEASUREMENT_MAX_QUOTA) |
406 | { | 405 | { |
407 | end(); | 406 | end(); |
408 | return; | 407 | return; |
409 | } | 408 | } |
409 | if (is_asymmetric_send_constant == GNUNET_YES) | ||
410 | { | ||
411 | if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) | ||
412 | measure (current_quota_p1 * 2, MEASUREMENT_MAX_QUOTA); | ||
413 | else | ||
414 | measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA); | ||
415 | } | ||
416 | else if (is_asymmetric_recv_constant == GNUNET_YES) | ||
417 | { | ||
418 | if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) | ||
419 | measure (MEASUREMENT_MAX_QUOTA, current_quota_p2 * 2); | ||
420 | else | ||
421 | measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA); | ||
422 | } | ||
410 | else | 423 | else |
411 | { | 424 | { |
412 | if (is_asymmetric_send_constant == GNUNET_YES) | 425 | if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) |
413 | measure (current_quota_p1 / 10, MEASUREMENT_MAX_QUOTA); | 426 | measure ((current_quota_p1) * 2, (current_quota_p2) * 2); |
414 | else if (is_asymmetric_recv_constant == GNUNET_YES) | ||
415 | measure (MEASUREMENT_MAX_QUOTA, current_quota_p2 / 10); | ||
416 | else | 427 | else |
417 | measure (current_quota_p1 / 10, current_quota_p2 / 10); | 428 | measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MAX_QUOTA); |
418 | } | 429 | } |
419 | } | 430 | } |
420 | 431 | ||
@@ -496,7 +507,12 @@ notify_connect (void *cls, | |||
496 | } | 507 | } |
497 | if (connected == 2) | 508 | if (connected == 2) |
498 | { | 509 | { |
499 | measure(MEASUREMENT_MAX_QUOTA,MEASUREMENT_MAX_QUOTA); | 510 | if (is_asymmetric_send_constant == GNUNET_YES) |
511 | measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MAX_QUOTA); | ||
512 | else if (is_asymmetric_recv_constant == GNUNET_YES) | ||
513 | measure (MEASUREMENT_MAX_QUOTA, MEASUREMENT_MIN_QUOTA); | ||
514 | else | ||
515 | measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MIN_QUOTA); | ||
500 | } | 516 | } |
501 | } | 517 | } |
502 | 518 | ||