}
+static void
+handle_client_view_request_cancel (void *cls,
+ const struct GNUNET_MessageHeader *msg)
+{
+ struct ClientContext *cli_ctx = cls;
+ uint64_t num_updates;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Client does not want to receive updates of view any more.\n",
+ num_updates);
+
+ GNUNET_assert (NULL != cli_ctx);
+ cli_ctx->view_updates_left = 0;
+ if (GNUNET_YES == cli_ctx->stream_update)
+ {
+ destroy_cli_ctx (cli_ctx);
+ }
+ GNUNET_SERVICE_client_continue (cli_ctx->client);
+}
+
+
/**
* Handle RPS request for biased stream from the client.
*
GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_REQUEST,
struct GNUNET_RPS_CS_DEBUG_ViewRequest,
NULL),
+ GNUNET_MQ_hd_fixed_size (client_view_request_cancel,
+ GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_CANCEL,
+ struct GNUNET_MessageHeader,
+ NULL),
GNUNET_MQ_hd_fixed_size (client_stream_request,
GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_REQUEST,
struct GNUNET_RPS_CS_DEBUG_StreamRequest,
max_size = 1000; // TODO make input to _samplers_init()
sampler = GNUNET_new (struct RPS_Sampler);
-
sampler->max_round_interval = max_round_interval;
sampler->get_peers = sampler_mod_get_rand_peer;
//sampler->sampler_elements = GNUNET_new_array(init_size, struct GNUNET_PeerIdentity);
}
+void
+GNUNET_RPS_view_request_cancel (struct GNUNET_RPS_Handle *rps_handle)
+{
+ struct GNUNET_MQ_Envelope *ev;
+
+ GNUNET_assert (NULL != rps_handle->view_update_cb);
+
+ rps_handle->view_update_cb = NULL;
+
+ ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_CANCEL);
+ GNUNET_MQ_send (rps_handle->mq, ev);
+}
+
+
/**
* Request biased stream of peers that are being put into the sampler
*
if (NULL != h->stream_requests_head)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Still waiting for requests\n");
+ "Still waiting for replies\n");
+ }
+ if (NULL != h->view_update_cb)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Still waiting for view updates\n");
}
GNUNET_free (h);
}