aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r--src/transport/test_transport_api.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index ceba9c3c7..f944fac61 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -37,8 +37,6 @@
37#include "transport.h" 37#include "transport.h"
38#include "transport-testing.h" 38#include "transport-testing.h"
39 39
40#define VERBOSE GNUNET_NO
41#define VERBOSE_ARM GNUNET_NO
42 40
43#define START_ARM GNUNET_YES 41#define START_ARM GNUNET_YES
44 42
@@ -52,9 +50,9 @@
52 */ 50 */
53#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 51#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
54 52
55#define MSIZE 2600 53#define TEST_MESSAGE_SIZE 2600
56 54
57#define MTYPE 12345 55#define TEST_MESSAGE_TYPE 12345
58 56
59static char *test_source; 57static char *test_source;
60 58
@@ -88,11 +86,6 @@ static char *cfg_file_p1;
88 86
89static char *cfg_file_p2; 87static char *cfg_file_p2;
90 88
91#if VERBOSE
92#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
93#else
94#define OKPP do { ok++; } while (0)
95#endif
96 89
97static void 90static void
98end () 91end ()
@@ -188,8 +181,8 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
188 GNUNET_i2s (&t->id)); 181 GNUNET_i2s (&t->id));
189 GNUNET_free (ps); 182 GNUNET_free (ps);
190 183
191 if ((MTYPE == ntohs (message->type)) && 184 if ((TEST_MESSAGE_TYPE == ntohs (message->type)) &&
192 (MSIZE == ntohs (message->size))) 185 (TEST_MESSAGE_SIZE == ntohs (message->size)))
193 { 186 {
194 ok = 0; 187 ok = 0;
195 end (); 188 end ();
@@ -222,13 +215,13 @@ notify_ready (void *cls, size_t size, void *buf)
222 return 0; 215 return 0;
223 } 216 }
224 217
225 GNUNET_assert (size >= MSIZE); 218 GNUNET_assert (size >= TEST_MESSAGE_SIZE);
226 if (buf != NULL) 219 if (buf != NULL)
227 { 220 {
228 memset (buf, '\0', MSIZE); 221 memset (buf, '\0', TEST_MESSAGE_SIZE);
229 hdr = buf; 222 hdr = buf;
230 hdr->size = htons (MSIZE); 223 hdr->size = htons (TEST_MESSAGE_SIZE);
231 hdr->type = htons (MTYPE); 224 hdr->type = htons (TEST_MESSAGE_TYPE);
232 } 225 }
233 226
234 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id)); 227 char *ps = GNUNET_strdup (GNUNET_i2s (&p2->id));
@@ -238,7 +231,7 @@ notify_ready (void *cls, size_t size, void *buf)
238 GNUNET_i2s (&p->id)); 231 GNUNET_i2s (&p->id));
239 GNUNET_free (ps); 232 GNUNET_free (ps);
240 233
241 return MSIZE; 234 return TEST_MESSAGE_SIZE;
242} 235}
243 236
244 237
@@ -256,7 +249,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
256 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); 249 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s);
257 GNUNET_free (receiver_s); 250 GNUNET_free (receiver_s);
258 s_sending = GNUNET_YES; 251 s_sending = GNUNET_YES;
259 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, MSIZE, 0, 252 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0,
260 TIMEOUT_TRANSMIT, &notify_ready, 253 TIMEOUT_TRANSMIT, &notify_ready,
261 p1); 254 p1);
262} 255}
@@ -384,9 +377,6 @@ check ()
384 static char *const argv[] = { "test-transport-api", 377 static char *const argv[] = { "test-transport-api",
385 "-c", 378 "-c",
386 "test_transport_api_data.conf", 379 "test_transport_api_data.conf",
387#if VERBOSE
388 "-L", "DEBUG",
389#endif
390 NULL 380 NULL
391 }; 381 };
392 static struct GNUNET_GETOPT_CommandLineOption options[] = { 382 static struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -416,13 +406,8 @@ main (int argc, char *argv[])
416 &test_plugin); 406 &test_plugin);
417 407
418 GNUNET_log_setup (test_name, 408 GNUNET_log_setup (test_name,
419#if VERBOSE
420 "DEBUG",
421#else
422 "WARNING", 409 "WARNING",
423#endif
424 NULL); 410 NULL);
425
426 tth = GNUNET_TRANSPORT_TESTING_init (); 411 tth = GNUNET_TRANSPORT_TESTING_init ();
427 412
428 GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1); 413 GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);