aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-08-04 14:46:16 +0000
committerChristian Grothoff <christian@grothoff.org>2016-08-04 14:46:16 +0000
commit2e5663d57acba21e81fd7c5eff0d5655d114f6e3 (patch)
tree03fd773d7ed0dd6957a9487b2e5114dd4b08ef3c /src/testbed
parenteec2c020a1dc14565e0c79dfe8216636a29fefda (diff)
downloadgnunet-2e5663d57acba21e81fd7c5eff0d5655d114f6e3.tar.gz
gnunet-2e5663d57acba21e81fd7c5eff0d5655d114f6e3.zip
-migrate testbed to new MQ API
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c35
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c8
2 files changed, 22 insertions, 21 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 3115285ea..b0e369c6a 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -605,24 +605,30 @@ oprelease_get_handle_transport (void *cls)
605 * 605 *
606 * @param cls the #PooledConnection object 606 * @param cls the #PooledConnection object
607 * @param peer peer identity this notification is about 607 * @param peer peer identity this notification is about
608 * @param mq message queue for talking to @a peer
609 * @return peer
608 */ 610 */
609static void 611static void *
610core_peer_connect_cb (void *cls, 612core_peer_connect_cb (void *cls,
611 const struct GNUNET_PeerIdentity *peer) 613 const struct GNUNET_PeerIdentity *peer,
614 struct GNUNET_MQ_Handle *mq)
612{ 615{
613 struct PooledConnection *entry = cls; 616 struct PooledConnection *entry = cls;
614 617
615 peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_CORE); 618 peer_connect_notify_cb (entry,
619 peer,
620 GST_CONNECTIONPOOL_SERVICE_CORE);
621 return (void *) peer;
616} 622}
617 623
618 624
619/** 625/**
620 * Function called after #GNUNET_CORE_connect() has succeeded (or failed 626 * Function called after #GNUNET_CORE_connecT() has succeeded (or failed
621 * for good). Note that the private key of the peer is intentionally 627 * for good). Note that the private key of the peer is intentionally
622 * not exposed here; if you need it, your process should try to read 628 * not exposed here; if you need it, your process should try to read
623 * the private key file directly (which should work if you are 629 * the private key file directly (which should work if you are
624 * authorized...). Implementations of this function must not call 630 * authorized...). Implementations of this function must not call
625 * #GNUNET_CORE_disconnect() (other than by scheduling a new task to 631 * #GNUNET_CORE_disconnecT() (other than by scheduling a new task to
626 * do this later). 632 * do this later).
627 * 633 *
628 * @param cls the #PooledConnection object 634 * @param cls the #PooledConnection object
@@ -664,22 +670,17 @@ static void
664opstart_get_handle_core (void *cls) 670opstart_get_handle_core (void *cls)
665{ 671{
666 struct PooledConnection *entry = cls; 672 struct PooledConnection *entry = cls;
667 const struct GNUNET_CORE_MessageHandler no_handlers[] = {
668 {NULL, 0, 0}
669 };
670 673
671 GNUNET_assert (NULL != entry); 674 GNUNET_assert (NULL != entry);
672 LOG_DEBUG ("Opening a CORE connection to peer %u\n", entry->index); 675 LOG_DEBUG ("Opening a CORE connection to peer %u\n",
673 entry->handle_core = 676 entry->index);
674 GNUNET_CORE_connect (entry->cfg, entry, /* closure */ 677 entry->handle_core
678 = GNUNET_CORE_connecT (entry->cfg,
679 entry, /* closure */
675 &core_startup_cb, /* core startup notify */ 680 &core_startup_cb, /* core startup notify */
676 &core_peer_connect_cb, /* peer connect notify */ 681 &core_peer_connect_cb, /* peer connect notify */
677 NULL, /* peer disconnect notify */ 682 NULL, /* peer disconnect notify */
678 NULL, /* inbound notify */ 683 NULL);
679 GNUNET_NO, /* inbound header only? */
680 NULL, /* outbound notify */
681 GNUNET_NO, /* outbound header only? */
682 no_handlers);
683} 684}
684 685
685 686
@@ -696,7 +697,7 @@ oprelease_get_handle_core (void *cls)
696 697
697 if (NULL == entry->handle_core) 698 if (NULL == entry->handle_core)
698 return; 699 return;
699 GNUNET_CORE_disconnect (entry->handle_core); 700 GNUNET_CORE_disconnecT (entry->handle_core);
700 entry->handle_core = NULL; 701 entry->handle_core = NULL;
701 GNUNET_free_non_null (entry->peer_identity); 702 GNUNET_free_non_null (entry->peer_identity);
702 entry->peer_identity = NULL; 703 entry->peer_identity = NULL;
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index 754f6e18d..63ea27c04 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2008--2015 GNUnet e.V. 3 Copyright (C) 2008--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
@@ -1133,9 +1133,9 @@ occ_cache_get_handle_core_cb (void *cls,
1133 return; 1133 return;
1134 } 1134 }
1135 occ->emsg = NULL; 1135 occ->emsg = NULL;
1136 if (GNUNET_YES == 1136 if (NULL !=
1137 GNUNET_CORE_is_peer_connected_sync (ch, 1137 GNUNET_CORE_get_mq (ch,
1138 &occ->other_peer_identity)) 1138 &occ->other_peer_identity))
1139 { 1139 {
1140 LOG_DEBUG ("0x%llx: Target peer already connected\n", 1140 LOG_DEBUG ("0x%llx: Target peer already connected\n",
1141 occ->op_id); 1141 occ->op_id);