gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 26/64: finalize protocol change (fixes message los


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 26/64: finalize protocol change (fixes message loss when leaving a place)
Date: Sat, 30 Dec 2017 20:58:11 +0100

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

lurchi pushed a commit to branch master
in repository gnunet.

commit 5d2fadf532f771a93f0c3873b5b47b73a0652b96
Author: lurchi <address@hidden>
AuthorDate: Mon Nov 13 18:21:14 2017 +0100

    finalize protocol change (fixes message loss when leaving a place)
---
 src/social/social_api.c | 77 +++----------------------------------------------
 1 file changed, 4 insertions(+), 73 deletions(-)

diff --git a/src/social/social_api.c b/src/social/social_api.c
index 8c6629432..87b46821e 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -1599,32 +1599,6 @@ GNUNET_SOCIAL_host_disconnect (struct GNUNET_SOCIAL_Host 
*hst,
 
 
 /**
- * Closure for #host_leave_cont.
- */
-struct HostLeaveContext
-{
-  struct GNUNET_SOCIAL_Host *hst;
-  GNUNET_ContinuationCallback disconnect_cb;
-  void *disconnect_cb_cls;
-};
-
-
-/**
- * FIXME.
- */
-static void
-host_leave_cont (void *cls)
-{
-  struct HostLeaveContext *hlc = cls;
-
-  GNUNET_SOCIAL_host_disconnect (hlc->hst,
-                                 hlc->disconnect_cb,
-                                 hlc->disconnect_cb_cls);
-  GNUNET_free (hlc);
-}
-
-
-/**
  * Stop hosting the home.
  *
  * Sends a _notice_place_closing announcement to the home.
@@ -1649,21 +1623,15 @@ GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host 
*hst,
 {
   struct GNUNET_MessageHeader *msg;
   struct GNUNET_MQ_Envelope *envelope;
-  struct HostLeaveContext *hlc;
 
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "GNUNET_SOCIAL_host_leave\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);
-  hlc = GNUNET_new (struct HostLeaveContext);
-  hlc->hst = hst;
-  hlc->disconnect_cb = disconnect_cb;
-  hlc->disconnect_cb_cls = cls;
-  GNUNET_MQ_notify_sent (envelope,
-                         &host_leave_cont,
-                         hlc);
   GNUNET_MQ_send (hst->plc.mq,
                   envelope);
 }
@@ -2101,37 +2069,6 @@ GNUNET_SOCIAL_guest_disconnect (struct 
GNUNET_SOCIAL_Guest *gst,
 
 
 /**
- * Closure for #leave_done_cont.
- */
-struct LeaveContext
-{
-  struct GNUNET_SOCIAL_Guest *gst;
-  GNUNET_ContinuationCallback disconnect_cb;
-  void *disconnect_cb_cls;
-};
-
-
-/**
- * The leave message was transmitted, now complete the
- * disconnection process.
- *
- * @param cls a `struct LeaveContext`
- */
-static void
-leave_done_cont (void *cls)
-{
-  struct LeaveContext *lc = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "social_api: guest's place_leave message sent!\n");
-  GNUNET_SOCIAL_guest_disconnect (lc->gst,
-                                  lc->disconnect_cb,
-                                  lc->disconnect_cb_cls);
-  GNUNET_free (lc);
-}
-
-
-/**
  * Leave a place temporarily or permanently.
  *
  * Notifies the owner of the place about leaving, and destroys the place 
handle.
@@ -2155,7 +2092,6 @@ GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest 
*gst,
 {
   struct GNUNET_MessageHeader *msg;
   struct GNUNET_MQ_Envelope *envelope;
-  struct LeaveContext *lc;
 
   GNUNET_SOCIAL_guest_talk (gst, "_notice_place_leave", env, NULL, NULL,
                             GNUNET_SOCIAL_TALK_NONE);
@@ -2163,15 +2099,10 @@ GNUNET_SOCIAL_guest_leave (struct GNUNET_SOCIAL_Guest 
*gst,
 
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "social_api: place_leave\n");
+  gst->plc.disconnect_cb = disconnect_cb;
+  gst->plc.disconnect_cls = cls;
   envelope = GNUNET_MQ_msg (msg,
                             GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
-  lc = GNUNET_new (struct LeaveContext);
-  lc->gst = gst;
-  lc->disconnect_cb = disconnect_cb;
-  lc->disconnect_cb_cls = cls;
-  GNUNET_MQ_notify_sent (envelope,
-                         &leave_done_cont,
-                         lc);
   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]