From 2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Jun 2016 18:50:00 +0000 Subject: redefine GNUNET_MQ_queue_for_connection_client to capture client handle --- src/util/mq.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/util/mq.c') diff --git a/src/util/mq.c b/src/util/mq.c index 4170338ad..c14b4b91d 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -206,7 +206,7 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MQ_MessageHandler *handler; int handled = GNUNET_NO; uint16_t ms = ntohs (mh->size); - + if (NULL == mq->handlers) goto done; for (handler = mq->handlers; NULL != handler->cb; handler++) @@ -665,6 +665,9 @@ static void connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) { + struct ClientConnectionState *state = impl_state; + + GNUNET_CLIENT_disconnect (state->connection); GNUNET_free (impl_state); } @@ -692,6 +695,7 @@ connection_client_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) { struct ClientConnectionState *state = impl_state; + GNUNET_assert (NULL != state->th); GNUNET_CLIENT_notify_transmit_ready_cancel (state->th); state->th = NULL; @@ -723,9 +727,9 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti state = GNUNET_new (struct ClientConnectionState); state->connection = connection; mq->impl_state = state; - mq->send_impl = connection_client_send_impl; - mq->destroy_impl = connection_client_destroy_impl; - mq->cancel_impl = connection_client_cancel_impl; + mq->send_impl = &connection_client_send_impl; + mq->destroy_impl = &connection_client_destroy_impl; + mq->cancel_impl = &connection_client_cancel_impl; if (NULL != handlers) state->receive_requested = GNUNET_YES; -- cgit v1.2.3