Handle cancellation of stream on the service-side
authorJulius Bünger <buenger@mytum.de>
Wed, 26 Sep 2018 19:38:31 +0000 (21:38 +0200)
committerJulius Bünger <buenger@mytum.de>
Wed, 26 Sep 2018 19:38:52 +0000 (21:38 +0200)
src/rps/gnunet-service-rps.c

index 64cb5ac986afc7a482bf5ba0f4992ab97ec41777..f20f494921cf99abe1e5d5ddb722a4e49bff712d 100644 (file)
@@ -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 */