diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-09 22:08:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-09 22:08:13 +0000 |
commit | 8e3b51ed07eed00fc5c37c9e43a9bc7f8fd6694c (patch) | |
tree | 6e47aa3d6b5682d58d25dc7267cabb7b5f82cffc | |
parent | 073fbda74b204ebaaac8a8a97a348d620a490d10 (diff) | |
download | gnunet-8e3b51ed07eed00fc5c37c9e43a9bc7f8fd6694c.tar.gz gnunet-8e3b51ed07eed00fc5c37c9e43a9bc7f8fd6694c.zip |
-fix compiler warning, fix test logic
-rw-r--r-- | src/transport/test_plugin_transport.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 39911863f..e41a2d0e4 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -256,6 +256,7 @@ wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
256 | end (); | 256 | end (); |
257 | } | 257 | } |
258 | 258 | ||
259 | |||
259 | static void | 260 | static void |
260 | end_badly_now () | 261 | end_badly_now () |
261 | { | 262 | { |
@@ -272,11 +273,12 @@ end_badly_now () | |||
272 | timeout_endbadly = GNUNET_SCHEDULER_add_now (&end_badly, NULL ); | 273 | timeout_endbadly = GNUNET_SCHEDULER_add_now (&end_badly, NULL ); |
273 | } | 274 | } |
274 | 275 | ||
276 | |||
275 | static struct GNUNET_TIME_Relative | 277 | static struct GNUNET_TIME_Relative |
276 | env_receive (void *cls, | 278 | env_receive (void *cls, |
277 | const struct GNUNET_HELLO_Address *address, | 279 | const struct GNUNET_HELLO_Address *address, |
278 | struct Session *session, | 280 | struct Session *session, |
279 | const struct GNUNET_MessageHeader *message) | 281 | const struct GNUNET_MessageHeader *message) |
280 | { | 282 | { |
281 | /* do nothing */ | 283 | /* do nothing */ |
282 | return GNUNET_TIME_relative_get_zero_ (); | 284 | return GNUNET_TIME_relative_get_zero_ (); |
@@ -284,36 +286,46 @@ env_receive (void *cls, | |||
284 | 286 | ||
285 | static int got_reply; | 287 | static int got_reply; |
286 | 288 | ||
289 | |||
287 | /** | 290 | /** |
288 | * Take the given address and append it to the set of results sent back to | 291 | * Take the given address and append it to the set of results sent back to |
289 | * the client. | 292 | * the client. |
290 | * | 293 | * |
291 | * @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*') | 294 | * @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*') |
292 | * @param buf text to transmit | 295 | * @param buf one of the names for the host, NULL on last callback |
296 | * @param res #GNUNET_OK if conversion was successful, #GNUNET_SYSERR on failure, | ||
297 | * #GNUNET_OK on last callback | ||
293 | */ | 298 | */ |
294 | static void | 299 | static void |
295 | address_pretty_printer_cb (void *cls, const char *buf) | 300 | address_pretty_printer_cb (void *cls, |
301 | const char *buf, | ||
302 | int res) | ||
296 | { | 303 | { |
297 | if (NULL != buf) | 304 | if (NULL != buf) |
298 | { | 305 | { |
299 | got_reply = GNUNET_YES; | 306 | got_reply = GNUNET_YES; |
300 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Pretty address : `%s'\n", buf); | 307 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
308 | "Pretty address : `%s'\n", | ||
309 | buf); | ||
301 | pretty_printers_running--; | 310 | pretty_printers_running--; |
302 | } | 311 | } |
303 | else | 312 | else |
304 | { | 313 | { |
305 | if (GNUNET_NO == got_reply) | 314 | if ( (GNUNET_OK == res) && |
315 | (GNUNET_NO == got_reply) ) | ||
306 | { | 316 | { |
307 | pretty_printers_running--; | 317 | pretty_printers_running--; |
308 | GNUNET_break(0); | 318 | GNUNET_break (0); |
309 | end_badly_now (); | 319 | end_badly_now (); |
310 | } | 320 | } |
311 | } | 321 | } |
312 | } | 322 | } |
313 | 323 | ||
324 | |||
314 | static void | 325 | static void |
315 | env_notify_address (void *cls, int add_remove, | 326 | env_notify_address (void *cls, |
316 | const struct GNUNET_HELLO_Address *address) | 327 | int add_remove, |
328 | const struct GNUNET_HELLO_Address *address) | ||
317 | { | 329 | { |
318 | struct AddressWrapper *w; | 330 | struct AddressWrapper *w; |
319 | struct AddressWrapper *wtmp; | 331 | struct AddressWrapper *wtmp; |
@@ -460,6 +472,7 @@ env_notify_address (void *cls, int add_remove, | |||
460 | } | 472 | } |
461 | } | 473 | } |
462 | 474 | ||
475 | |||
463 | static struct GNUNET_ATS_Information | 476 | static struct GNUNET_ATS_Information |
464 | env_get_address_type (void *cls, const struct sockaddr *addr, size_t addrlen) | 477 | env_get_address_type (void *cls, const struct sockaddr *addr, size_t addrlen) |
465 | { | 478 | { |
@@ -469,12 +482,14 @@ env_get_address_type (void *cls, const struct sockaddr *addr, size_t addrlen) | |||
469 | return ats; | 482 | return ats; |
470 | } | 483 | } |
471 | 484 | ||
485 | |||
472 | static const struct GNUNET_MessageHeader * | 486 | static const struct GNUNET_MessageHeader * |
473 | env_get_our_hello () | 487 | env_get_our_hello () |
474 | { | 488 | { |
475 | return (const struct GNUNET_MessageHeader *) hello; | 489 | return (const struct GNUNET_MessageHeader *) hello; |
476 | } | 490 | } |
477 | 491 | ||
492 | |||
478 | static void | 493 | static void |
479 | env_session_end (void *cls, | 494 | env_session_end (void *cls, |
480 | const struct GNUNET_HELLO_Address *address, | 495 | const struct GNUNET_HELLO_Address *address, |
@@ -483,15 +498,17 @@ env_session_end (void *cls, | |||
483 | 498 | ||
484 | } | 499 | } |
485 | 500 | ||
501 | |||
486 | static void | 502 | static void |
487 | env_update_metrics (void *cls, | 503 | env_update_metrics (void *cls, |
488 | const struct GNUNET_HELLO_Address *address, | 504 | const struct GNUNET_HELLO_Address *address, |
489 | struct Session *session, | 505 | struct Session *session, |
490 | const struct GNUNET_ATS_Information *ats, | 506 | const struct GNUNET_ATS_Information *ats, |
491 | uint32_t ats_count) | 507 | uint32_t ats_count) |
492 | { | 508 | { |
493 | } | 509 | } |
494 | 510 | ||
511 | |||
495 | static void | 512 | static void |
496 | setup_plugin_environment () | 513 | setup_plugin_environment () |
497 | { | 514 | { |
@@ -508,13 +525,15 @@ setup_plugin_environment () | |||
508 | env.session_end = &env_session_end; | 525 | env.session_end = &env_session_end; |
509 | } | 526 | } |
510 | 527 | ||
528 | |||
511 | static int | 529 | static int |
512 | handle_helper_message (void *cls, void *client, | 530 | handle_helper_message (void *cls, void *client, |
513 | const struct GNUNET_MessageHeader *hdr) | 531 | const struct GNUNET_MessageHeader *hdr) |
514 | { | 532 | { |
515 | return GNUNET_OK; | 533 | return GNUNET_OK; |
516 | } | 534 | } |
517 | 535 | ||
536 | |||
518 | /** | 537 | /** |
519 | * Runs the test. | 538 | * Runs the test. |
520 | * | 539 | * |