From 2e5663d57acba21e81fd7c5eff0d5655d114f6e3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 4 Aug 2016 14:46:16 +0000 Subject: [PATCH] -migrate testbed to new MQ API --- .../gnunet-service-testbed_connectionpool.c | 35 ++++++++++--------- src/testbed/gnunet-service-testbed_oc.c | 8 ++--- 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) * * @param cls the #PooledConnection object * @param peer peer identity this notification is about + * @param mq message queue for talking to @a peer + * @return peer */ -static void +static void * core_peer_connect_cb (void *cls, - const struct GNUNET_PeerIdentity *peer) + const struct GNUNET_PeerIdentity *peer, + struct GNUNET_MQ_Handle *mq) { struct PooledConnection *entry = cls; - peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_CORE); + peer_connect_notify_cb (entry, + peer, + GST_CONNECTIONPOOL_SERVICE_CORE); + return (void *) peer; } /** - * Function called after #GNUNET_CORE_connect() has succeeded (or failed + * Function called after #GNUNET_CORE_connecT() has succeeded (or failed * for good). Note that the private key of the peer is intentionally * not exposed here; if you need it, your process should try to read * the private key file directly (which should work if you are * authorized...). Implementations of this function must not call - * #GNUNET_CORE_disconnect() (other than by scheduling a new task to + * #GNUNET_CORE_disconnecT() (other than by scheduling a new task to * do this later). * * @param cls the #PooledConnection object @@ -664,22 +670,17 @@ static void opstart_get_handle_core (void *cls) { struct PooledConnection *entry = cls; - const struct GNUNET_CORE_MessageHandler no_handlers[] = { - {NULL, 0, 0} - }; GNUNET_assert (NULL != entry); - LOG_DEBUG ("Opening a CORE connection to peer %u\n", entry->index); - entry->handle_core = - GNUNET_CORE_connect (entry->cfg, entry, /* closure */ + LOG_DEBUG ("Opening a CORE connection to peer %u\n", + entry->index); + entry->handle_core + = GNUNET_CORE_connecT (entry->cfg, + entry, /* closure */ &core_startup_cb, /* core startup notify */ &core_peer_connect_cb, /* peer connect notify */ NULL, /* peer disconnect notify */ - NULL, /* inbound notify */ - GNUNET_NO, /* inbound header only? */ - NULL, /* outbound notify */ - GNUNET_NO, /* outbound header only? */ - no_handlers); + NULL); } @@ -696,7 +697,7 @@ oprelease_get_handle_core (void *cls) if (NULL == entry->handle_core) return; - GNUNET_CORE_disconnect (entry->handle_core); + GNUNET_CORE_disconnecT (entry->handle_core); entry->handle_core = NULL; GNUNET_free_non_null (entry->peer_identity); 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 @@ /* This file is part of GNUnet. - Copyright (C) 2008--2015 GNUnet e.V. + Copyright (C) 2008--2016 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -1133,9 +1133,9 @@ occ_cache_get_handle_core_cb (void *cls, return; } occ->emsg = NULL; - if (GNUNET_YES == - GNUNET_CORE_is_peer_connected_sync (ch, - &occ->other_peer_identity)) + if (NULL != + GNUNET_CORE_get_mq (ch, + &occ->other_peer_identity)) { LOG_DEBUG ("0x%llx: Target peer already connected\n", occ->op_id); -- 2.25.1