diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-02-03 16:11:49 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-02-03 16:11:49 +0000 |
commit | 7a441138e549ac5bbc1974a23653bb77c51a8bb1 (patch) | |
tree | 04405168216df13a370a106fd7f92f554887dae9 /src/transport/test_transport_api_reliability.c | |
parent | 7b7f7a9152bec8f8bd6d85e88cc57ba231a22bd2 (diff) | |
download | gnunet-7a441138e549ac5bbc1974a23653bb77c51a8bb1.tar.gz gnunet-7a441138e549ac5bbc1974a23653bb77c51a8bb1.zip |
unix domain socket transport, associated test cases
Diffstat (limited to 'src/transport/test_transport_api_reliability.c')
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 414a8cdd6..306e88ed8 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "gnunet_scheduler_lib.h" | 34 | #include "gnunet_scheduler_lib.h" |
35 | #include "gnunet_server_lib.h" | 35 | #include "gnunet_server_lib.h" |
36 | #include "gnunet_transport_service.h" | 36 | #include "gnunet_transport_service.h" |
37 | #include "gauger.h" | ||
37 | #include "transport.h" | 38 | #include "transport.h" |
38 | 39 | ||
39 | #define VERBOSE GNUNET_NO | 40 | #define VERBOSE GNUNET_NO |
@@ -82,6 +83,8 @@ static int is_https; | |||
82 | 83 | ||
83 | static int is_udp; | 84 | static int is_udp; |
84 | 85 | ||
86 | static int is_unix; | ||
87 | |||
85 | static int connected; | 88 | static int connected; |
86 | 89 | ||
87 | static unsigned long long total_bytes; | 90 | static unsigned long long total_bytes; |
@@ -95,7 +98,7 @@ static char * cert_file_p1; | |||
95 | 98 | ||
96 | static char * key_file_p2; | 99 | static char * key_file_p2; |
97 | static char * cert_file_p2; | 100 | static char * cert_file_p2; |
98 | 101 | static char *test_name; | |
99 | static int msg_scheduled; | 102 | static int msg_scheduled; |
100 | static int msg_sent; | 103 | static int msg_sent; |
101 | static int msg_recv_expected; | 104 | static int msg_recv_expected; |
@@ -113,6 +116,7 @@ static void | |||
113 | end () | 116 | end () |
114 | { | 117 | { |
115 | unsigned long long delta; | 118 | unsigned long long delta; |
119 | char *value_name; | ||
116 | 120 | ||
117 | GNUNET_SCHEDULER_cancel (die_task); | 121 | GNUNET_SCHEDULER_cancel (die_task); |
118 | die_task = GNUNET_SCHEDULER_NO_TASK; | 122 | die_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -129,6 +133,9 @@ end () | |||
129 | fprintf (stderr, | 133 | fprintf (stderr, |
130 | "\nThroughput was %llu kb/s\n", | 134 | "\nThroughput was %llu kb/s\n", |
131 | total_bytes * 1000 / 1024 / delta); | 135 | total_bytes * 1000 / 1024 / delta); |
136 | GNUNET_asprintf(&value_name, "reliable_kbs_%s", test_name); | ||
137 | GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta)); | ||
138 | GNUNET_free(value_name); | ||
132 | ok = 0; | 139 | ok = 0; |
133 | 140 | ||
134 | } | 141 | } |
@@ -665,6 +672,11 @@ run (void *cls, | |||
665 | setup_peer (&p1, "test_transport_api_udp_peer1.conf"); | 672 | setup_peer (&p1, "test_transport_api_udp_peer1.conf"); |
666 | setup_peer (&p2, "test_transport_api_udp_peer2.conf"); | 673 | setup_peer (&p2, "test_transport_api_udp_peer2.conf"); |
667 | } | 674 | } |
675 | else if (is_unix) | ||
676 | { | ||
677 | setup_peer (&p1, "test_transport_api_unix_peer1.conf"); | ||
678 | setup_peer (&p2, "test_transport_api_unix_peer2.conf"); | ||
679 | } | ||
668 | else if (is_tcp_nat) | 680 | else if (is_tcp_nat) |
669 | { | 681 | { |
670 | setup_peer (&p1, "test_transport_api_tcp_nat_peer1.conf"); | 682 | setup_peer (&p1, "test_transport_api_tcp_nat_peer1.conf"); |
@@ -768,22 +780,32 @@ main (int argc, char *argv[]) | |||
768 | if (strstr(argv[0], "tcp_nat") != NULL) | 780 | if (strstr(argv[0], "tcp_nat") != NULL) |
769 | { | 781 | { |
770 | is_tcp_nat = GNUNET_YES; | 782 | is_tcp_nat = GNUNET_YES; |
783 | GNUNET_asprintf(&test_name, "tcp_nat"); | ||
771 | } | 784 | } |
772 | else if (strstr(argv[0], "tcp") != NULL) | 785 | else if (strstr(argv[0], "tcp") != NULL) |
773 | { | 786 | { |
774 | is_tcp = GNUNET_YES; | 787 | is_tcp = GNUNET_YES; |
788 | GNUNET_asprintf(&test_name, "tcp"); | ||
775 | } | 789 | } |
776 | else if (strstr(argv[0], "https") != NULL) | 790 | else if (strstr(argv[0], "https") != NULL) |
777 | { | 791 | { |
778 | is_https = GNUNET_YES; | 792 | is_https = GNUNET_YES; |
793 | GNUNET_asprintf(&test_name, "https"); | ||
779 | } | 794 | } |
780 | else if (strstr(argv[0], "http") != NULL) | 795 | else if (strstr(argv[0], "http") != NULL) |
781 | { | 796 | { |
782 | is_http = GNUNET_YES; | 797 | is_http = GNUNET_YES; |
798 | GNUNET_asprintf(&test_name, "http"); | ||
783 | } | 799 | } |
784 | else if (strstr(argv[0], "udp") != NULL) | 800 | else if (strstr(argv[0], "udp") != NULL) |
785 | { | 801 | { |
786 | is_udp = GNUNET_YES; | 802 | is_udp = GNUNET_YES; |
803 | GNUNET_asprintf(&test_name, "udp"); | ||
804 | } | ||
805 | else if (strstr(argv[0], "unix") != NULL) | ||
806 | { | ||
807 | is_unix = GNUNET_YES; | ||
808 | GNUNET_asprintf(&test_name, "unix"); | ||
787 | } | 809 | } |
788 | GNUNET_log_setup ("test-transport-api-reliability", | 810 | GNUNET_log_setup ("test-transport-api-reliability", |
789 | #if VERBOSE | 811 | #if VERBOSE |