From ccf16c9d0542a04a3fa175305a807d7c0a0a65db Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Wed, 26 Sep 2018 21:38:31 +0200 Subject: Handle cancellation of stream on the service-side --- src/rps/gnunet-service-rps.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src') diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 64cb5ac98..f20f49492 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -2781,6 +2781,32 @@ handle_client_stream_request (void *cls, } +/** + * @brief Handles the cancellation of the stream of biased peer ids + * + * @param cls The client context + * @param msg unused + */ +static void +handle_client_stream_cancel (void *cls, + const struct GNUNET_MessageHeader *msg) +{ + struct ClientContext *cli_ctx = cls; + (void) msg; + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Client requested peers from biased stream.\n"); + cli_ctx->stream_update = GNUNET_NO; + + GNUNET_assert (NULL != cli_ctx); + GNUNET_SERVICE_client_continue (cli_ctx->client); + if (0 == cli_ctx->view_updates_left) + { + destroy_cli_ctx (cli_ctx); + } +} + + /** * Handle a CHECK_LIVE message from another peer. * @@ -4112,6 +4138,10 @@ GNUNET_SERVICE_MAIN GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_REQUEST, struct GNUNET_RPS_CS_DEBUG_StreamRequest, NULL), + GNUNET_MQ_hd_fixed_size (client_stream_cancel, + GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_CANCEL, + struct GNUNET_MessageHeader, + NULL), GNUNET_MQ_handler_end()); /* end of gnunet-service-rps.c */ -- cgit v1.2.3