diff options
Diffstat (limited to 'src/transport/test_transport_api_unreliability_constant.c')
-rw-r--r-- | src/transport/test_transport_api_unreliability_constant.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index c8638cd23..3ce256017 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c | |||
@@ -71,7 +71,7 @@ struct PeerContext *p2; | |||
71 | 71 | ||
72 | struct GNUNET_TRANSPORT_TransmitHandle *th; | 72 | struct GNUNET_TRANSPORT_TransmitHandle *th; |
73 | 73 | ||
74 | struct GNUNET_TRANSPORT_TESTING_handle * tth; | 74 | struct GNUNET_TRANSPORT_TESTING_handle *tth; |
75 | 75 | ||
76 | char *cfg_file_p1; | 76 | char *cfg_file_p1; |
77 | 77 | ||
@@ -154,7 +154,7 @@ end () | |||
154 | th = NULL; | 154 | th = NULL; |
155 | 155 | ||
156 | if (cc != NULL) | 156 | if (cc != NULL) |
157 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc); | 157 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); |
158 | cc = NULL; | 158 | cc = NULL; |
159 | 159 | ||
160 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); | 160 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); |
@@ -165,7 +165,8 @@ end () | |||
165 | ok = 0; | 165 | ok = 0; |
166 | if (test_failed == GNUNET_NO) | 166 | if (test_failed == GNUNET_NO) |
167 | ok = GNUNET_SYSERR; | 167 | ok = GNUNET_SYSERR; |
168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GOT %u of %u messages\n", msg_recv, TOTAL_MSGS); | 168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GOT %u of %u messages\n", msg_recv, |
169 | TOTAL_MSGS); | ||
169 | } | 170 | } |
170 | 171 | ||
171 | static void | 172 | static void |
@@ -186,7 +187,7 @@ end_badly () | |||
186 | th = NULL; | 187 | th = NULL; |
187 | 188 | ||
188 | if (cc != NULL) | 189 | if (cc != NULL) |
189 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel(tth, cc); | 190 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); |
190 | cc = NULL; | 191 | cc = NULL; |
191 | 192 | ||
192 | if (p1 != NULL) | 193 | if (p1 != NULL) |
@@ -217,8 +218,7 @@ get_size (unsigned int iter) | |||
217 | static void | 218 | static void |
218 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | 219 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
219 | const struct GNUNET_MessageHeader *message, | 220 | const struct GNUNET_MessageHeader *message, |
220 | const struct GNUNET_ATS_Information *ats, | 221 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) |
221 | uint32_t ats_count) | ||
222 | { | 222 | { |
223 | static int n; | 223 | static int n; |
224 | 224 | ||
@@ -234,8 +234,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
234 | msg_recv = ntohl (hdr->num); | 234 | msg_recv = ntohl (hdr->num); |
235 | if (msg_recv_expected != msg_recv) | 235 | if (msg_recv_expected != msg_recv) |
236 | { | 236 | { |
237 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 237 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Expected message no %u, got %u\n", |
238 | "Expected message no %u, got %u\n", | ||
239 | msg_recv_expected, msg_recv); | 238 | msg_recv_expected, msg_recv); |
240 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | 239 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
241 | GNUNET_SCHEDULER_cancel (die_task); | 240 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -373,8 +372,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
373 | 372 | ||
374 | static void | 373 | static void |
375 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | 374 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, |
376 | const struct GNUNET_ATS_Information *ats, | 375 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) |
377 | uint32_t ats_count) | ||
378 | { | 376 | { |
379 | 377 | ||
380 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n", | 378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n", |
@@ -415,20 +413,21 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
415 | GNUNET_SCHEDULER_add_now (&sendtask, NULL); | 413 | GNUNET_SCHEDULER_add_now (&sendtask, NULL); |
416 | } | 414 | } |
417 | 415 | ||
418 | void start_cb (struct PeerContext * p, | 416 | void |
419 | void *cls) | 417 | start_cb (struct PeerContext *p, void *cls) |
420 | { | 418 | { |
421 | static int started; | 419 | static int started; |
420 | |||
422 | started++; | 421 | started++; |
423 | 422 | ||
424 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') started\n", | 423 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') started\n", p->no, |
425 | p->no, | 424 | GNUNET_i2s (&p->id)); |
426 | GNUNET_i2s (&p->id)); | ||
427 | 425 | ||
428 | if (started != 2) | 426 | if (started != 2) |
429 | return; | 427 | return; |
430 | 428 | ||
431 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL); | 429 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, |
430 | NULL); | ||
432 | } | 431 | } |
433 | 432 | ||
434 | static void | 433 | static void |
@@ -438,14 +437,12 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
438 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 437 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
439 | 438 | ||
440 | p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p1, 1, | 439 | p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p1, 1, |
441 | ¬ify_receive, | 440 | ¬ify_receive, ¬ify_connect, |
442 | ¬ify_connect, ¬ify_disconnect, | 441 | ¬ify_disconnect, &start_cb, |
443 | &start_cb, | ||
444 | NULL); | 442 | NULL); |
445 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p2, 2, | 443 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p2, 2, |
446 | ¬ify_receive, | 444 | ¬ify_receive, ¬ify_connect, |
447 | ¬ify_connect, ¬ify_disconnect, | 445 | ¬ify_disconnect, &start_cb, |
448 | &start_cb, | ||
449 | NULL); | 446 | NULL); |
450 | 447 | ||
451 | if ((p1 == NULL) || (p2 == NULL)) | 448 | if ((p1 == NULL) || (p2 == NULL)) |