gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 03/64: don't call GNUNET_SERVICE_client_continue t


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 03/64: don't call GNUNET_SERVICE_client_continue twice; maybe fix bug resulting from destroying MQ too early
Date: Sat, 30 Dec 2017 20:57:48 +0100

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

lurchi pushed a commit to branch master
in repository gnunet.

commit 7478bbf75478b0df49ba06379888aae3632c2bf5
Author: lurchi <address@hidden>
AuthorDate: Fri Oct 13 20:56:09 2017 +0200

    don't call GNUNET_SERVICE_client_continue twice; maybe fix bug resulting 
from destroying MQ too early
---
 src/social/gnunet-service-social.c | 60 ++++++++++++++++++++++----------------
 src/social/social_api.c            |  5 ++--
 2 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/src/social/gnunet-service-social.c 
b/src/social/gnunet-service-social.c
index 30e113f18..f888564dc 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -1878,23 +1878,9 @@ guest_enter (const struct GuestEnterRequest *greq, 
struct Guest **ret_gst)
 
 
 static int
-check_client_guest_enter (void *cls,
-                          const struct GuestEnterRequest *greq)
-{
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle a connecting client entering a place as guest.
- */
-static void
-handle_client_guest_enter (void *cls,
-                           const struct GuestEnterRequest *greq)
+client_guest_enter (struct Client *c,
+                    const struct GuestEnterRequest *greq)
 {
-  // FIXME: this must not be called directly by gns_result_guest_enter because 
then
-  // GNUNET_SERVICE_client_continue is called twice
-  struct Client *c = cls;
   struct GNUNET_SERVICE_Client *client = c->client;
 
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1906,9 +1892,7 @@ handle_client_guest_enter (void *cls,
                                                     remaining, 1, &app_id);
   if (0 == offset)
   {
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (client);
-    return;
+    return GNUNET_SYSERR;
   }
 
   struct Guest *gst = NULL;
@@ -1941,9 +1925,7 @@ handle_client_guest_enter (void *cls,
     break;
   }
   case GNUNET_SYSERR:
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (client);
-    return;
+    return GNUNET_SYSERR;
   }
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1953,9 +1935,36 @@ handle_client_guest_enter (void *cls,
   struct ClientListItem *cli = GNUNET_new (struct ClientListItem);
   cli->client = client;
   GNUNET_CONTAINER_DLL_insert (plc->clients_head, plc->clients_tail, cli);
+  return GNUNET_OK; 
+}
 
-  c->place = plc;
-  GNUNET_SERVICE_client_continue (client);
+
+static int
+check_client_guest_enter (void *cls,
+                          const struct GuestEnterRequest *greq)
+{
+  return GNUNET_OK;
+}
+
+
+/**
+ * Handle a connecting client entering a place as guest.
+ */
+static void
+handle_client_guest_enter (void *cls,
+                           const struct GuestEnterRequest *greq)
+{
+  // FIXME: this must not be called directly by gns_result_guest_enter because 
then
+  // GNUNET_SERVICE_client_continue is called twice
+  struct Client *c = cls;
+
+  if (GNUNET_SYSERR == client_guest_enter (c, greq))
+  {
+    GNUNET_break (0);
+    GNUNET_SERVICE_client_drop (c->client);
+    return;
+  }
+  GNUNET_SERVICE_client_continue (c->client);
 }
 
 
@@ -2032,7 +2041,7 @@ gns_result_guest_enter (void *cls, uint32_t rd_count,
   p += relay_size;
   GNUNET_memcpy (p, gcls->join_msg, join_msg_size);
 
-  handle_client_guest_enter (c, greq);
+  client_guest_enter (c, greq);
 
   GNUNET_free (gcls->app_id);
   if (NULL != gcls->password)
@@ -2261,6 +2270,7 @@ handle_client_place_leave (void *cls,
     }
   }
   //GNUNET_SERVICE_client_continue (client);
+  //GNUNET_SERVICE_client_drop (client);
 }
 
 
diff --git a/src/social/social_api.c b/src/social/social_api.c
index 04b671120..a190b2f26 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -1085,9 +1085,10 @@ place_disconnect (struct GNUNET_SOCIAL_Place *plc)
               plc);
   if (NULL != plc->mq)
   {
-    struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq);
-    if (NULL != env)
+    //struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq);
+    if (GNUNET_MQ_get_length (plc->mq) > 0)
     {
+      struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq);
       GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) 
place_disconnect, plc);
     }
     else

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



reply via email to

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