diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-19 18:50:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-19 18:50:00 +0000 |
commit | 2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd (patch) | |
tree | 58be8b2e7321a91015df8ab3281a9f89a26cec1f /src/util/mq.c | |
parent | d8d3021ad9af2abe551fd6cd0fe2529a99d3683c (diff) | |
download | gnunet-2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd.tar.gz gnunet-2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd.zip |
redefine GNUNET_MQ_queue_for_connection_client to capture client handle
Diffstat (limited to 'src/util/mq.c')
-rw-r--r-- | src/util/mq.c | 12 |
1 files changed, 8 insertions, 4 deletions
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, | |||
206 | const struct GNUNET_MQ_MessageHandler *handler; | 206 | const struct GNUNET_MQ_MessageHandler *handler; |
207 | int handled = GNUNET_NO; | 207 | int handled = GNUNET_NO; |
208 | uint16_t ms = ntohs (mh->size); | 208 | uint16_t ms = ntohs (mh->size); |
209 | 209 | ||
210 | if (NULL == mq->handlers) | 210 | if (NULL == mq->handlers) |
211 | goto done; | 211 | goto done; |
212 | for (handler = mq->handlers; NULL != handler->cb; handler++) | 212 | for (handler = mq->handlers; NULL != handler->cb; handler++) |
@@ -665,6 +665,9 @@ static void | |||
665 | connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq, | 665 | connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq, |
666 | void *impl_state) | 666 | void *impl_state) |
667 | { | 667 | { |
668 | struct ClientConnectionState *state = impl_state; | ||
669 | |||
670 | GNUNET_CLIENT_disconnect (state->connection); | ||
668 | GNUNET_free (impl_state); | 671 | GNUNET_free (impl_state); |
669 | } | 672 | } |
670 | 673 | ||
@@ -692,6 +695,7 @@ connection_client_cancel_impl (struct GNUNET_MQ_Handle *mq, | |||
692 | void *impl_state) | 695 | void *impl_state) |
693 | { | 696 | { |
694 | struct ClientConnectionState *state = impl_state; | 697 | struct ClientConnectionState *state = impl_state; |
698 | |||
695 | GNUNET_assert (NULL != state->th); | 699 | GNUNET_assert (NULL != state->th); |
696 | GNUNET_CLIENT_notify_transmit_ready_cancel (state->th); | 700 | GNUNET_CLIENT_notify_transmit_ready_cancel (state->th); |
697 | state->th = NULL; | 701 | state->th = NULL; |
@@ -723,9 +727,9 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti | |||
723 | state = GNUNET_new (struct ClientConnectionState); | 727 | state = GNUNET_new (struct ClientConnectionState); |
724 | state->connection = connection; | 728 | state->connection = connection; |
725 | mq->impl_state = state; | 729 | mq->impl_state = state; |
726 | mq->send_impl = connection_client_send_impl; | 730 | mq->send_impl = &connection_client_send_impl; |
727 | mq->destroy_impl = connection_client_destroy_impl; | 731 | mq->destroy_impl = &connection_client_destroy_impl; |
728 | mq->cancel_impl = connection_client_cancel_impl; | 732 | mq->cancel_impl = &connection_client_cancel_impl; |
729 | if (NULL != handlers) | 733 | if (NULL != handlers) |
730 | state->receive_requested = GNUNET_YES; | 734 | state->receive_requested = GNUNET_YES; |
731 | 735 | ||