From 33fccc1e9f5fde308fc6f2ee39b3340ab06aa715 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 23 Jan 2017 23:54:09 +0100 Subject: [PATCH] simplify logic --- src/cadet/cadet_api.c | 40 ++++++++++++++++------------------------ src/cadet/test_cadet.c | 3 ++- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 89d9daeda..a3b23d913 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -513,29 +513,6 @@ remove_from_queue (struct GNUNET_CADET_TransmitHandle *th) } -/** - * Send an ack on the channel to confirm the processing of a message. - * - * @param ch Channel on which to send the ACK. - */ -static void -send_ack (struct GNUNET_CADET_Channel *ch) -{ - struct GNUNET_CADET_LocalAck *msg; - struct GNUNET_MQ_Envelope *env; - - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); - - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending ACK on channel %X\n", - ch->ccn.channel_of_client); - msg->ccn = ch->ccn; - GNUNET_MQ_send (ch->cadet->mq, - env); -} - - /******************************************************************************/ /*********************** RECEIVE HANDLERS ****************************/ @@ -1749,10 +1726,25 @@ GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle *t } +/** + * Send an ack on the channel to confirm the processing of a message. + * + * @param ch Channel on which to send the ACK. + */ void GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel) { - send_ack (channel); + struct GNUNET_CADET_LocalAck *msg; + struct GNUNET_MQ_Envelope *env; + + env = GNUNET_MQ_msg (msg, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Sending ACK on channel %X\n", + channel->ccn.channel_of_client); + msg->ccn = channel->ccn; + GNUNET_MQ_send (channel->cadet->mq, + env); } diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index ce0178bd5..2f50a7346 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -633,7 +633,8 @@ data_callback (void *cls, { if (NULL != disconnect_task) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, " reschedule timeout\n"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + " reschedule timeout\n"); GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &gather_stats_and_exit, -- 2.25.1