aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-10-29 15:41:17 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-10-29 15:41:17 +0000
commitc9120ae89d8ff588162c49ffa4553567d59f0351 (patch)
tree0ee453b3f8a3372fa3b0bb114ac5840a839dd2a9
parent6cc39bc9d1e13c66495540ecde96414495102d6f (diff)
downloadgnunet-c9120ae89d8ff588162c49ffa4553567d59f0351.tar.gz
gnunet-c9120ae89d8ff588162c49ffa4553567d59f0351.zip
more asymmetric tests
-rw-r--r--src/transport/test_quota_compliance.c66
1 files changed, 48 insertions, 18 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 3614fa0d7..895b5c36a 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -148,11 +148,7 @@ static GNUNET_SCHEDULER_TaskIdentifier measurement_counter_task;
148 148
149struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle; 149struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle;
150 150
151#if VERBOSE
152#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
153#else
154#define OKPP do { ok++; } while (0) 151#define OKPP do { ok++; } while (0)
155#endif
156 152
157 153
158 154
@@ -356,6 +352,7 @@ static void
356measurement_end (void *cls, 352measurement_end (void *cls,
357 const struct GNUNET_SCHEDULER_TaskContext *tc) 353 const struct GNUNET_SCHEDULER_TaskContext *tc)
358{ 354{
355 int quota_allowed = 0;
359 measurement_task = GNUNET_SCHEDULER_NO_TASK; 356 measurement_task = GNUNET_SCHEDULER_NO_TASK;
360 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 357 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
361 return; 358 return;
@@ -379,12 +376,18 @@ measurement_end (void *cls,
379 transmit_handle = NULL; 376 transmit_handle = NULL;
380 } 377 }
381 */ 378 */
382 if ((total_bytes/(duration.rel_value / 1000)) > (current_quota_p1 + (current_quota_p1 / 10))) 379
380 if (current_quota_p1 < current_quota_p2)
381 quota_allowed = current_quota_p1;
382 else
383 quota_allowed = current_quota_p2;
384
385 if ((total_bytes/(duration.rel_value / 1000)) > (quota_allowed + (quota_allowed / 10)))
383 { 386 {
384 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 387 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
385 "\nQuota compliance failed: \n"\ 388 "\nQuota compliance failed: \n"\
386 "Quota allowed: %10llu kB/s\n"\ 389 "Quota allowed: %10llu kB/s\n"\
387 "Throughput : %10llu kB/s\n", (current_quota_p1 / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024)); 390 "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024));
388 ok = 1; 391 ok = 1;
389/* end(); 392/* end();
390 return;*/ 393 return;*/
@@ -395,21 +398,17 @@ measurement_end (void *cls,
395 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 398 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
396 "\nQuota compliance ok: \n"\ 399 "\nQuota compliance ok: \n"\
397 "Quota allowed: %10llu kB/s\n"\ 400 "Quota allowed: %10llu kB/s\n"\
398 "Throughput : %10llu kB/s\n", (current_quota_p1 / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024)); 401 "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024));
399 ok = 0; 402 ok = 0;
400 } 403 }
401 404
402 if ((current_quota_p1 < MEASUREMENT_MIN_QUOTA) || (current_quota_p2 < MEASUREMENT_MIN_QUOTA)) 405 if (quota_allowed < MEASUREMENT_MIN_QUOTA)
403 { 406 {
404 end(); 407 end();
405 return; 408 return;
406 } 409 }
407 else 410 else
408 { 411 {
409#if VERBOSE
410 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
411 "Scheduling next measurement\n");
412#endif
413 if (is_asymmetric_send_constant == GNUNET_YES) 412 if (is_asymmetric_send_constant == GNUNET_YES)
414 measure (current_quota_p1 / 10, MEASUREMENT_MAX_QUOTA); 413 measure (current_quota_p1 / 10, MEASUREMENT_MAX_QUOTA);
415 else if (is_asymmetric_recv_constant == GNUNET_YES) 414 else if (is_asymmetric_recv_constant == GNUNET_YES)
@@ -424,8 +423,13 @@ static void measure (unsigned long long quota_p1, unsigned long long quota_p2 )
424 current_quota_p1 = quota_p1; 423 current_quota_p1 = quota_p1;
425 current_quota_p2 = quota_p2; 424 current_quota_p2 = quota_p2;
426#if VERBOSE 425#if VERBOSE
427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 426 if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES))
428 "Starting transport level measurement for %u seconds and p1 quota %llu kB/s p2 quota %llu\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024, current_quota_p2 / 1024); 427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
428 "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);
429 else
430 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
431 "Starting transport level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2 / 1024);
432
429#endif 433#endif
430 GNUNET_TRANSPORT_set_quota (p1.th, 434 GNUNET_TRANSPORT_set_quota (p1.th,
431 &p2.id, 435 &p2.id,
@@ -587,30 +591,56 @@ run (void *cls,
587 591
588 if (is_tcp) 592 if (is_tcp)
589 { 593 {
590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for TCP transport plugin\n"); 594 if (is_asymmetric_recv_constant == GNUNET_YES)
595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for TCP transport plugin\n");
596 else if (is_asymmetric_send_constant == GNUNET_YES)
597 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for TCP transport plugin\n");
598 else
599 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for TCP transport plugin\n");
591 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf"); 600 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf");
592 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf"); 601 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf");
593 } 602 }
594 else if (is_http) 603 else if (is_http)
595 { 604 {
596 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for HTTP transport plugin\n"); 605 if (is_asymmetric_recv_constant == GNUNET_YES)
606 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for HTTP transport plugin\n");
607 else if (is_asymmetric_send_constant == GNUNET_YES)
608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for HTTP transport plugin\n");
609 else
610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for HTTP transport plugin\n");
597 setup_peer (&p1, "test_quota_compliance_http_peer1.conf"); 611 setup_peer (&p1, "test_quota_compliance_http_peer1.conf");
598 setup_peer (&p2, "test_quota_compliance_http_peer2.conf"); 612 setup_peer (&p2, "test_quota_compliance_http_peer2.conf");
599 } 613 }
600 else if (is_https) 614 else if (is_https)
601 { 615 {
602 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for HTTPS transport plugin\n"); 616 if (is_asymmetric_recv_constant == GNUNET_YES)
617 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for HTTPS transport plugin\n");
618 else if (is_asymmetric_send_constant == GNUNET_YES)
619 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for HTTPS transport plugin\n");
620 else
621 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for HTTPS transport plugin\n");
603 setup_peer (&p1, "test_quota_compliance_https_peer1.conf"); 622 setup_peer (&p1, "test_quota_compliance_https_peer1.conf");
604 setup_peer (&p2, "test_quota_compliance_https_peer2.conf"); 623 setup_peer (&p2, "test_quota_compliance_https_peer2.conf");
605 } 624 }
606 else if (is_udp) 625 else if (is_udp)
607 { 626 {
608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing quota compliance for UDP transport plugin\n"); 627 if (is_asymmetric_recv_constant == GNUNET_YES)
628 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for UDP transport plugin\n");
629 else if (is_asymmetric_send_constant == GNUNET_YES)
630 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for UDP transport plugin\n");
631 else
632 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for UDP transport plugin\n");
609 setup_peer (&p1, "test_quota_compliance_udp_peer1.conf"); 633 setup_peer (&p1, "test_quota_compliance_udp_peer1.conf");
610 setup_peer (&p2, "test_quota_compliance_udp_peer2.conf"); 634 setup_peer (&p2, "test_quota_compliance_udp_peer2.conf");
611 } 635 }
612 else if (is_tcp_nat) 636 else if (is_tcp_nat)
613 { 637 {
638 if (is_asymmetric_recv_constant == GNUNET_YES)
639 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (receiver quota constant) for TCP NAT transport plugin\n");
640 else if (is_asymmetric_send_constant == GNUNET_YES)
641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing asymmetric quota compliance (sender quota constant) for TCP NAT transport plugin\n");
642 else
643 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing symmetric quota compliance for TCP NAT transport plugin\n");
614 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf"); 644 setup_peer (&p1, "test_quota_compliance_tcp_peer1.conf");
615 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf"); 645 setup_peer (&p2, "test_quota_compliance_tcp_peer2.conf");
616 } 646 }