diff options
Diffstat (limited to 'src/util/test_connection_timeout.c')
-rw-r--r-- | src/util/test_connection_timeout.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c index c0597b24b..8d3f775b5 100644 --- a/src/util/test_connection_timeout.c +++ b/src/util/test_connection_timeout.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include "gnunet_scheduler_lib.h" | 27 | #include "gnunet_scheduler_lib.h" |
28 | #include "gnunet_time_lib.h" | 28 | #include "gnunet_time_lib.h" |
29 | 29 | ||
30 | #define VERBOSE GNUNET_NO | ||
31 | |||
32 | #define PORT 12435 | 30 | #define PORT 12435 |
33 | 31 | ||
34 | static struct GNUNET_CONNECTION_Handle *csock; | 32 | static struct GNUNET_CONNECTION_Handle *csock; |
@@ -78,18 +76,14 @@ send_kilo (void *cls, size_t size, void *buf) | |||
78 | 76 | ||
79 | if (size == 0) | 77 | if (size == 0) |
80 | { | 78 | { |
81 | #if VERBOSE | ||
82 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got the desired timeout!\n"); | 79 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got the desired timeout!\n"); |
83 | #endif | ||
84 | GNUNET_assert (buf == NULL); | 80 | GNUNET_assert (buf == NULL); |
85 | *ok = 0; | 81 | *ok = 0; |
86 | GNUNET_CONNECTION_destroy (lsock); | 82 | GNUNET_CONNECTION_destroy (lsock); |
87 | GNUNET_CONNECTION_destroy (csock); | 83 | GNUNET_CONNECTION_destroy (csock); |
88 | return 0; | 84 | return 0; |
89 | } | 85 | } |
90 | #if VERBOSE | ||
91 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending kilo to fill buffer.\n"); | 86 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending kilo to fill buffer.\n"); |
92 | #endif | ||
93 | GNUNET_assert (size >= 1024); | 87 | GNUNET_assert (size >= 1024); |
94 | memset (buf, 42, 1024); | 88 | memset (buf, 42, 1024); |
95 | 89 | ||
@@ -117,15 +111,15 @@ task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
117 | } | 111 | } |
118 | 112 | ||
119 | 113 | ||
120 | 114 | int | |
121 | /** | 115 | main (int argc, char *argv[]) |
122 | * Main method, starts scheduler with task_timeout. | ||
123 | */ | ||
124 | static int | ||
125 | check_timeout () | ||
126 | { | 116 | { |
127 | int ok; | 117 | int ok; |
128 | 118 | ||
119 | GNUNET_log_setup ("test_connection_timeout", | ||
120 | "WARNING", | ||
121 | NULL); | ||
122 | |||
129 | ok = 1; | 123 | ok = 1; |
130 | cfg = GNUNET_CONFIGURATION_create (); | 124 | cfg = GNUNET_CONFIGURATION_create (); |
131 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", | 125 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", |
@@ -135,20 +129,4 @@ check_timeout () | |||
135 | return ok; | 129 | return ok; |
136 | } | 130 | } |
137 | 131 | ||
138 | int | ||
139 | main (int argc, char *argv[]) | ||
140 | { | ||
141 | int ret = 0; | ||
142 | |||
143 | GNUNET_log_setup ("test_connection_timeout", | ||
144 | #if VERBOSE | ||
145 | "DEBUG", | ||
146 | #else | ||
147 | "WARNING", | ||
148 | #endif | ||
149 | NULL); | ||
150 | ret += check_timeout (); | ||
151 | return ret; | ||
152 | } | ||
153 | |||
154 | /* end of test_connection_timeout.c */ | 132 | /* end of test_connection_timeout.c */ |