diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-30 17:29:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-30 17:29:00 +0000 |
commit | 24dc89edc8d7f9eb5f23cd3e804fd9732858fbee (patch) | |
tree | 8c2062b0309958537a8e2daca5ce448625250686 /src/core/test_core_api_reliability.c | |
parent | fc0a7982cd82e6f1915589a89c61dbe9d58aedb3 (diff) | |
download | gnunet-24dc89edc8d7f9eb5f23cd3e804fd9732858fbee.tar.gz gnunet-24dc89edc8d7f9eb5f23cd3e804fd9732858fbee.zip |
converting core tests to hello_get API
Diffstat (limited to 'src/core/test_core_api_reliability.c')
-rw-r--r-- | src/core/test_core_api_reliability.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index a4a6d182c..c5ee12478 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2015 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_ats_service.h" | 28 | #include "gnunet_ats_service.h" |
29 | #include "gnunet_transport_service.h" | 29 | #include "gnunet_transport_service.h" |
30 | #include "gnunet_transport_hello_service.h" | ||
30 | #include <gauger.h> | 31 | #include <gauger.h> |
31 | 32 | ||
32 | /** | 33 | /** |
@@ -63,7 +64,7 @@ struct PeerContext | |||
63 | struct GNUNET_PeerIdentity id; | 64 | struct GNUNET_PeerIdentity id; |
64 | struct GNUNET_TRANSPORT_OfferHelloHandle *oh; | 65 | struct GNUNET_TRANSPORT_OfferHelloHandle *oh; |
65 | struct GNUNET_MessageHeader *hello; | 66 | struct GNUNET_MessageHeader *hello; |
66 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | 67 | struct GNUNET_TRANSPORT_HelloGetHandle *ghh; |
67 | struct GNUNET_ATS_ConnectivityHandle *ats; | 68 | struct GNUNET_ATS_ConnectivityHandle *ats; |
68 | struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; | 69 | struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; |
69 | int connect_status; | 70 | int connect_status; |
@@ -112,7 +113,7 @@ terminate_peer (struct PeerContext *p) | |||
112 | } | 113 | } |
113 | if (NULL != p->ghh) | 114 | if (NULL != p->ghh) |
114 | { | 115 | { |
115 | GNUNET_TRANSPORT_get_hello_cancel (p->ghh); | 116 | GNUNET_TRANSPORT_hello_get_cancel (p->ghh); |
116 | p->ghh = NULL; | 117 | p->ghh = NULL; |
117 | } | 118 | } |
118 | if (NULL != p->oh) | 119 | if (NULL != p->oh) |
@@ -406,13 +407,17 @@ init_notify (void *cls, | |||
406 | GNUNET_assert (ok == 2); | 407 | GNUNET_assert (ok == 2); |
407 | OKPP; | 408 | OKPP; |
408 | /* connect p2 */ | 409 | /* connect p2 */ |
409 | GNUNET_assert (NULL != (p2.ch = GNUNET_CORE_connect (p2.cfg, &p2, | 410 | GNUNET_assert (NULL != |
410 | &init_notify, | 411 | (p2.ch = GNUNET_CORE_connect (p2.cfg, |
411 | &connect_notify, | 412 | &p2, |
412 | &disconnect_notify, | 413 | &init_notify, |
413 | &inbound_notify, GNUNET_YES, | 414 | &connect_notify, |
414 | &outbound_notify, GNUNET_YES, | 415 | &disconnect_notify, |
415 | handlers))); | 416 | &inbound_notify, |
417 | GNUNET_YES, | ||
418 | &outbound_notify, | ||
419 | GNUNET_YES, | ||
420 | handlers))); | ||
416 | } | 421 | } |
417 | else | 422 | else |
418 | { | 423 | { |
@@ -480,18 +485,22 @@ setup_peer (struct PeerContext *p, | |||
480 | 485 | ||
481 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); | 486 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); |
482 | p->cfg = GNUNET_CONFIGURATION_create (); | 487 | p->cfg = GNUNET_CONFIGURATION_create (); |
483 | p->arm_proc = | 488 | p->arm_proc |
484 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | 489 | = GNUNET_OS_start_process (GNUNET_YES, |
485 | NULL, NULL, NULL, | 490 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
486 | binary, | 491 | NULL, NULL, NULL, |
487 | "gnunet-service-arm", | 492 | binary, |
488 | "-c", cfgname, NULL); | 493 | "gnunet-service-arm", |
494 | "-c", | ||
495 | cfgname, | ||
496 | NULL); | ||
489 | GNUNET_assert (GNUNET_OK == | 497 | GNUNET_assert (GNUNET_OK == |
490 | GNUNET_CONFIGURATION_load (p->cfg, | 498 | GNUNET_CONFIGURATION_load (p->cfg, |
491 | cfgname)); | 499 | cfgname)); |
492 | p->ats = GNUNET_ATS_connectivity_init (p->cfg); | 500 | p->ats = GNUNET_ATS_connectivity_init (p->cfg); |
493 | GNUNET_assert (NULL != p->ats); | 501 | GNUNET_assert (NULL != p->ats); |
494 | p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, | 502 | p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg, |
503 | GNUNET_TRANSPORT_AC_ANY, | ||
495 | &process_hello, | 504 | &process_hello, |
496 | p); | 505 | p); |
497 | GNUNET_free (binary); | 506 | GNUNET_free (binary); |
@@ -506,8 +515,10 @@ run (void *cls, | |||
506 | { | 515 | { |
507 | GNUNET_assert (ok == 1); | 516 | GNUNET_assert (ok == 1); |
508 | OKPP; | 517 | OKPP; |
509 | setup_peer (&p1, "test_core_api_peer1.conf"); | 518 | setup_peer (&p1, |
510 | setup_peer (&p2, "test_core_api_peer2.conf"); | 519 | "test_core_api_peer1.conf"); |
520 | setup_peer (&p2, | ||
521 | "test_core_api_peer2.conf"); | ||
511 | err_task = | 522 | err_task = |
512 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 523 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
513 | &terminate_task_error, | 524 | &terminate_task_error, |
@@ -516,7 +527,8 @@ run (void *cls, | |||
516 | NULL); | 527 | NULL); |
517 | 528 | ||
518 | GNUNET_assert (NULL != | 529 | GNUNET_assert (NULL != |
519 | (p1.ch = GNUNET_CORE_connect (p1.cfg, &p1, | 530 | (p1.ch = GNUNET_CORE_connect (p1.cfg, |
531 | &p1, | ||
520 | &init_notify, | 532 | &init_notify, |
521 | &connect_notify, | 533 | &connect_notify, |
522 | &disconnect_notify, | 534 | &disconnect_notify, |
@@ -548,7 +560,8 @@ stop_arm (struct PeerContext *p) | |||
548 | 560 | ||
549 | 561 | ||
550 | int | 562 | int |
551 | main (int argc, char *argv1[]) | 563 | main (int argc, |
564 | char *argv1[]) | ||
552 | { | 565 | { |
553 | char *const argv[] = { | 566 | char *const argv[] = { |
554 | "test-core-api-reliability", | 567 | "test-core-api-reliability", |