gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 29/64: use comfort functions of MQ API


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 29/64: use comfort functions of MQ API
Date: Sat, 30 Dec 2017 20:58:14 +0100

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

lurchi pushed a commit to branch master
in repository gnunet.

commit 51a27f583432d57949e3f9ea4c5f3813e9589e42
Author: lurchi <address@hidden>
AuthorDate: Sat Nov 18 11:08:32 2017 +0100

    use comfort functions of MQ API
---
 src/social/gnunet-service-social.c | 36 ++++++++++++++++++++++++++----------
 src/social/social_api.c            | 18 ++++++++++++------
 2 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/src/social/gnunet-service-social.c 
b/src/social/gnunet-service-social.c
index 3e527cbaf..3f6999269 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -635,6 +635,22 @@ place_send_msg (const struct Place *plc,
 }
 
 
+static void
+place_send_leave_ack (const struct Place *plc)
+{
+  struct GNUNET_MQ_Envelope *env;
+  
+  for (struct ClientListItem *cli = plc->clients_head;
+       NULL != cli;
+       cli = cli->next)
+  {
+    env = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE_ACK);
+    GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (cli->client),
+                    env); 
+  }
+}
+
+
 /**
  * Send a result code back to the client.
  *
@@ -2139,7 +2155,6 @@ handle_client_place_leave (void *cls,
   struct Client *c = cls;
   struct GNUNET_SERVICE_Client *client = c->client;
   struct Place *plc = c->place;
-  struct GNUNET_MQ_Envelope *env;
 
   if (NULL == plc)
   {
@@ -2148,24 +2163,22 @@ handle_client_place_leave (void *cls,
     return;
   }
 
-  for (struct ClientListItem *cli = plc->clients_head;
-       NULL != cli;
-       cli = cli->next)
-  {
-    env = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE_ACK);
-    GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (cli->client),
-                    env); 
-  }
-
   if (GNUNET_YES != plc->is_disconnected)
   {
     plc->is_disconnected = GNUNET_YES;
     if (NULL != plc->tmit_msgs_head)
     { /* Send pending messages to PSYC before cleanup. */
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "not cleaning up place of client %p\n",
+                  client);
       psyc_transmit_message (plc);
     }
     else
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "cleaning up place of client %p\n",
+                  client);
+      place_send_leave_ack (plc);
       cleanup_place (plc);
       c->place = NULL;
     }
@@ -2867,6 +2880,9 @@ handle_client_psyc_message (void *cls,
 
   if (NULL == plc)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "received PSYC message for non-existing client %p\n",
+                client);
     GNUNET_break (0);
     GNUNET_SERVICE_client_drop (client);
     return;
diff --git a/src/social/social_api.c b/src/social/social_api.c
index 73587598b..f37c52e2c 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -398,6 +398,9 @@ place_cleanup (struct GNUNET_SOCIAL_Place *plc)
 {
   struct GNUNET_HashCode place_pub_hash;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "place_cleanup\n");
+
   GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash);
   if (NULL != plc->tmit)
   {
@@ -1511,6 +1514,8 @@ GNUNET_SOCIAL_host_announce (struct GNUNET_SOCIAL_Host 
*hst,
                              void *notify_data_cls,
                              enum GNUNET_SOCIAL_AnnounceFlags flags)
 {
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "PSYC_transmit_message for host\n");
   if (GNUNET_OK ==
       GNUNET_PSYC_transmit_message (hst->plc.tmit, method_name, env,
                                     NULL, notify_data, notify_data_cls, flags))
@@ -1606,15 +1611,15 @@ GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host 
*hst,
                           GNUNET_ContinuationCallback disconnect_cb,
                           void *cls)
 {
-  struct GNUNET_MessageHeader *msg;
   struct GNUNET_MQ_Envelope *envelope;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "sending _notice_place_closing\n");
   GNUNET_SOCIAL_host_announce (hst, "_notice_place_closing", env, NULL, NULL,
                                GNUNET_SOCIAL_ANNOUNCE_NONE);
   hst->plc.disconnect_cb = disconnect_cb;
   hst->plc.disconnect_cls = cls;
-  envelope = GNUNET_MQ_msg (msg,
-                            GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
+  envelope = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
   GNUNET_MQ_send (hst->plc.mq,
                   envelope);
 }
@@ -1987,6 +1992,9 @@ GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *gst,
                           void *notify_data_cls,
                           enum GNUNET_SOCIAL_TalkFlags flags)
 {
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "PSYC_transmit_message for guest\n");
+
   struct GNUNET_SOCIAL_Place *plc = &gst->plc;
   GNUNET_assert (NULL != plc->tmit);
 
@@ -2068,15 +2076,13 @@ GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest 
*gst,
                            GNUNET_ContinuationCallback disconnect_cb,
                            void *cls)
 {
-  struct GNUNET_MessageHeader *msg;
   struct GNUNET_MQ_Envelope *envelope;
 
   GNUNET_SOCIAL_guest_talk (gst, "_notice_place_leave", env, NULL, NULL,
                             GNUNET_SOCIAL_TALK_NONE);
   gst->plc.disconnect_cb = disconnect_cb;
   gst->plc.disconnect_cls = cls;
-  envelope = GNUNET_MQ_msg (msg,
-                            GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
+  envelope = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
   GNUNET_MQ_send (gst->plc.mq,
                   envelope);
 }

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



reply via email to

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