[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
- [GNUnet-SVN] [gnunet] 26/64: finalize protocol change (fixes message loss when leaving a place), (continued)
- [GNUnet-SVN] [gnunet] 26/64: finalize protocol change (fixes message loss when leaving a place), gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 47/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 39/64: WARNING -> DEBUG, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 37/64: mark channel as disconnectin when a part request is sent; cleanup, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 33/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 24/64: changed log levels, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 42/64: added logging, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 54/64: test_social: less services and less noise in the output, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 34/64: introduce part request / part ack messages (for leaving multicast groups) and related fixes, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 43/64: fixed compile error, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 29/64: use comfort functions of MQ API,
gnunet <=
- [GNUnet-SVN] [gnunet] 30/64: Introduce PART/PART_ACK messages (tests will fail until multicast module is adapted, too), gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 22/64: protocol change: add ack message for guests/hosts leaving a place, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 44/64: tried to print out stacktrace, not working. removed., gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 50/64: remove debug assertion; add debug output, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 59/64: master/slave pointers must not be NULL immediatly after sending leave request, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 58/64: fixing the place leave logic after protocol change, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 55/64: test_psyc: less services and less noise in the output, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 60/64: actually test reconnecting; result in enter callback must always be GNUNET_OK, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 56/64: result is a boolean; stylistic changes, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 52/64: stylistic fix, gnunet, 2017/12/30