gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (1d724e33b -> ccf16c9d0)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (1d724e33b -> ccf16c9d0)
Date: Wed, 26 Sep 2018 21:39:11 +0200

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a change to branch master
in repository gnunet.

    from 1d724e33b Start rps in any case
     new 8d45a78fb Remove leftovers of architecture change
     new cf847c747 Handle cancellation of view updates
     new 1e01cd7bf Update doxygen
     new 1d44c1e60 Fix details and style
     new ccf16c9d0 Handle cancellation of stream on the service-side

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/rps/gnunet-service-rps.c | 116 ++++++++++++++++++++++++-------------------
 src/rps/rps-sampler_client.c |   1 -
 src/rps/rps_api.c            |  21 +++++++-
 3 files changed, 85 insertions(+), 53 deletions(-)

diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index e3714bdba..f20f49492 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1759,12 +1759,6 @@ struct ClientContext
   struct GNUNET_MQ_Handle *mq;
 
   /**
-   * DLL with handles to single requests from the client
-   */
-  struct ReplyCls *rep_cls_head;
-  struct ReplyCls *rep_cls_tail;
-
-  /**
    * @brief How many updates this client expects to receive.
    */
   int64_t view_updates_left;
@@ -2597,34 +2591,9 @@ cleanup_destroyed_channel (void *cls,
 ***********************************************************************/
 
 static void
-destroy_reply_cls (struct ReplyCls *rep_cls)
-{
-  struct ClientContext *cli_ctx;
-
-  cli_ctx = rep_cls->cli_ctx;
-  GNUNET_assert (NULL != cli_ctx);
-  if (NULL != rep_cls->req_handle)
-  {
-    RPS_sampler_request_cancel (rep_cls->req_handle);
-  }
-  GNUNET_CONTAINER_DLL_remove (cli_ctx->rep_cls_head,
-                               cli_ctx->rep_cls_tail,
-                               rep_cls);
-  GNUNET_free (rep_cls);
-}
-
-
-static void
 destroy_cli_ctx (struct ClientContext *cli_ctx)
 {
   GNUNET_assert (NULL != cli_ctx);
-  if (NULL != cli_ctx->rep_cls_head)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Trying to destroy the context of a client that still has pending 
requests. Going to clean those\n");
-    while (NULL != cli_ctx->rep_cls_head)
-      destroy_reply_cls (cli_ctx->rep_cls_head);
-  }
   GNUNET_CONTAINER_DLL_remove (cli_ctx_head,
                                cli_ctx_tail,
                                cli_ctx);
@@ -2741,8 +2710,8 @@ handle_client_seed (void *cls,
 /**
  * Handle RPS request from the client.
  *
- * @param cls closure
- * @param message the actual message
+ * @param cls Client context
+ * @param message unused
  */
 static void
 handle_client_view_request (void *cls,
@@ -2765,10 +2734,36 @@ handle_client_view_request (void *cls,
 
 
 /**
+ * @brief Handle the cancellation of the view updates.
+ *
+ * @param cls The client context
+ * @param msg Unused
+ */
+static void
+handle_client_view_cancel (void *cls,
+                           const struct GNUNET_MessageHeader *msg)
+{
+  struct ClientContext *cli_ctx = cls;
+  (void) msg;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Client does not want to receive updates of view any more.\n");
+
+  GNUNET_assert (NULL != cli_ctx);
+  cli_ctx->view_updates_left = 0;
+  GNUNET_SERVICE_client_continue (cli_ctx->client);
+  if (GNUNET_YES == cli_ctx->stream_update)
+  {
+    destroy_cli_ctx (cli_ctx);
+  }
+}
+
+
+/**
  * Handle RPS request for biased stream from the client.
  *
- * @param cls closure
- * @param message the actual message
+ * @param cls Client context
+ * @param message unused
  */
 static void
 handle_client_stream_request (void *cls,
@@ -2787,6 +2782,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.
  *
  * This does nothing. But without calling #GNUNET_CADET_receive_done()
@@ -3787,7 +3808,6 @@ static void
 shutdown_task (void *cls)
 {
   struct ClientContext *client_ctx;
-  struct ReplyCls *reply_cls;
   (void) cls;
 
   in_shutdown = GNUNET_YES;
@@ -3800,21 +3820,7 @@ shutdown_task (void *cls)
        NULL != cli_ctx_head;
        client_ctx = cli_ctx_head)
   {
-    /* Clean pending requests to the sampler */
-    for (reply_cls = client_ctx->rep_cls_head;
-         NULL != client_ctx->rep_cls_head;
-         reply_cls = client_ctx->rep_cls_head)
-    {
-      RPS_sampler_request_cancel (reply_cls->req_handle);
-      GNUNET_CONTAINER_DLL_remove (client_ctx->rep_cls_head,
-                                   client_ctx->rep_cls_tail,
-                                   reply_cls);
-      GNUNET_free (reply_cls);
-    }
-    GNUNET_CONTAINER_DLL_remove (cli_ctx_head,
-                                 cli_ctx_tail,
-                                 client_ctx);
-    GNUNET_free (client_ctx);
+    destroy_cli_ctx (client_ctx);
   }
   GNUNET_PEERINFO_notify_cancel (peerinfo_notify_handle);
   GNUNET_PEERINFO_disconnect (peerinfo_handle);
@@ -4124,10 +4130,18 @@ GNUNET_SERVICE_MAIN
    GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_REQUEST,
    struct GNUNET_RPS_CS_DEBUG_ViewRequest,
    NULL),
+ GNUNET_MQ_hd_fixed_size (client_view_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,
    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 */
diff --git a/src/rps/rps-sampler_client.c b/src/rps/rps-sampler_client.c
index da832a323..4904b9d43 100644
--- a/src/rps/rps-sampler_client.c
+++ b/src/rps/rps-sampler_client.c
@@ -201,7 +201,6 @@ RPS_sampler_mod_init (size_t init_size,
   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);
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c
index 6e124644d..7d0674aff 100644
--- a/src/rps/rps_api.c
+++ b/src/rps/rps_api.c
@@ -344,6 +344,20 @@ GNUNET_RPS_view_request (struct GNUNET_RPS_Handle 
*rps_handle,
 }
 
 
+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
  *
@@ -879,7 +893,12 @@ GNUNET_RPS_disconnect (struct GNUNET_RPS_Handle *h)
   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);
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]