From e9a6c28aad064456c26923cf579f0ed9282afe3c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 21 Oct 2016 05:13:17 +0000 Subject: [PATCH] use new MQ in_flight API to support cancel in new service/client implementations --- src/util/client_new.c | 2 +- src/util/service_new.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/util/client_new.c b/src/util/client_new.c index a5bd996bb..b5c0147b3 100644 --- a/src/util/client_new.c +++ b/src/util/client_new.c @@ -261,7 +261,7 @@ transmit_ready (void *cls) } if (0 == cstate->msg_off) { - // FIXME: tell MQ that cancel is no longer possible! + GNUNET_MQ_impl_send_in_flight (cstate->mq); } cstate->msg_off += pos; if (cstate->msg_off < len) diff --git a/src/util/service_new.c b/src/util/service_new.c index 744adc387..8433c42bf 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c @@ -1974,6 +1974,10 @@ do_send (void *cls) return; } } + if (0 == client->msg_pos) + { + GNUNET_MQ_impl_send_in_flight (client->mq); + } client->msg_pos += ret; if (left > ret) { @@ -2026,9 +2030,10 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq, { struct GNUNET_SERVICE_Client *client = impl_state; - GNUNET_assert (0); // not implemented - // FIXME: stop transmission! (must be possible, otherwise - // we must have told MQ that the message was sent!) + GNUNET_assert (0 == client->msg_pos); + client->msg = NULL; + GNUNET_SCHEDULER_cancel (client->send_task); + client->send_task = NULL; } -- 2.25.1