/** C->S: request to leave a place */
#define GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE 848
+/** S->C: place leave acknowledgement */
+#define GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE_ACK 849
+
/** C->S: add place to GNS zone */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_PLACE 849
+#define GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_PLACE 850
/** C->S: add nym to GNS zone */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_NYM 850
+#define GNUNET_MESSAGE_TYPE_SOCIAL_ZONE_ADD_NYM 851
/** C->S: connect application */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT 851
+#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT 852
/** C->S: detach a place from application */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_DETACH 852
+#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_DETACH 853
/** S->C: notify about an existing ego */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO 853
+#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO 854
/** S->C: end of ego list */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END 854
+#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END 855
/** S->C: notify about an existing place */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE 855
+#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE 856
/** S->C: end of place list */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END 856
+#define GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END 857
/** C->S: set message processing flags */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET 860
+#define GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET 858
/** C->S: clear message processing flags */
-#define GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_CLEAR 861
+#define GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_CLEAR 859
/*******************************************************************************
* X-VINE DHT messages
};
+/*** CLEANUP / DISCONNECT ***/
+
+
+static void
+host_cleanup (struct GNUNET_SOCIAL_Host *hst)
+{
+ if (NULL != hst->slicer)
+ {
+ GNUNET_PSYC_slicer_destroy (hst->slicer);
+ hst->slicer = NULL;
+ }
+ GNUNET_free (hst);
+}
+
+
+static void
+guest_cleanup (struct GNUNET_SOCIAL_Guest *gst)
+{
+ GNUNET_free (gst);
+}
+
+
+static void
+place_cleanup (struct GNUNET_SOCIAL_Place *plc)
+{
+ struct GNUNET_HashCode place_pub_hash;
+
+ GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "%s place cleanup: %s\n",
+ GNUNET_YES == plc->is_host ? "host" : "guest",
+ GNUNET_h2s (&place_pub_hash));
+
+ if (NULL != plc->tmit)
+ {
+ GNUNET_PSYC_transmit_destroy (plc->tmit);
+ plc->tmit = NULL;
+ }
+ if (NULL != plc->connect_env)
+ {
+ GNUNET_MQ_discard (plc->connect_env);
+ plc->connect_env = NULL;
+ }
+ if (NULL != plc->mq)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "destroying MQ (place_cleanup)\n");
+ GNUNET_MQ_destroy (plc->mq);
+ plc->mq = NULL;
+ }
+ if (NULL != plc->disconnect_cb)
+ {
+ plc->disconnect_cb (plc->disconnect_cls);
+ plc->disconnect_cb = NULL;
+ }
+
+ (GNUNET_YES == plc->is_host)
+ ? host_cleanup ((struct GNUNET_SOCIAL_Host *) plc)
+ : guest_cleanup ((struct GNUNET_SOCIAL_Guest *) plc);
+}
+
+
+static void
+place_disconnect (struct GNUNET_SOCIAL_Place *plc)
+{
+ struct GNUNET_HashCode place_pub_hash;
+
+ GNUNET_CRYPTO_hash (&plc->pub_key,
+ sizeof (plc->pub_key),
+ &place_pub_hash);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "place_disconnect, plc = %s\n",
+ GNUNET_h2s (&place_pub_hash));
+ place_cleanup (plc);
+}
+
+
/*** NYM ***/
static struct GNUNET_SOCIAL_Nym *
}
-/*** CLEANUP / DISCONNECT ***/
-
-
-static void
-host_cleanup (struct GNUNET_SOCIAL_Host *hst)
-{
- if (NULL != hst->slicer)
- {
- GNUNET_PSYC_slicer_destroy (hst->slicer);
- hst->slicer = NULL;
- }
- GNUNET_free (hst);
-}
-
-
-static void
-guest_cleanup (struct GNUNET_SOCIAL_Guest *gst)
-{
- GNUNET_free (gst);
-}
-
-
-static void
-place_cleanup (struct GNUNET_SOCIAL_Place *plc)
-{
- struct GNUNET_HashCode place_pub_hash;
-
- GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s place cleanup: %s\n",
- GNUNET_YES == plc->is_host ? "host" : "guest",
- GNUNET_h2s (&place_pub_hash));
-
- if (NULL != plc->tmit)
- {
- GNUNET_PSYC_transmit_destroy (plc->tmit);
- plc->tmit = NULL;
- }
- if (NULL != plc->connect_env)
- {
- GNUNET_MQ_discard (plc->connect_env);
- plc->connect_env = NULL;
- }
- if (NULL != plc->mq)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "destroying MQ (place_cleanup)\n");
- GNUNET_MQ_destroy (plc->mq);
- plc->mq = NULL;
- }
- if (NULL != plc->disconnect_cb)
- {
- plc->disconnect_cb (plc->disconnect_cls);
- plc->disconnect_cb = NULL;
- }
-
- (GNUNET_YES == plc->is_host)
- ? host_cleanup ((struct GNUNET_SOCIAL_Host *) plc)
- : guest_cleanup ((struct GNUNET_SOCIAL_Guest *) plc);
-}
-
-
+/**
+ * Handle an acknowledgement that a guest or host left a place.
+ *
+ * @param cls a `struct GNUNET_SOCIAL_Place`
+ * @param msg the message from the service
+ */
static void
-place_disconnect (struct GNUNET_SOCIAL_Place *plc)
+handle_place_leave_ack (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
- struct GNUNET_HashCode place_pub_hash;
+ struct GNUNET_SOCIAL_Place *plc = cls;
- GNUNET_CRYPTO_hash (&plc->pub_key,
- sizeof (plc->pub_key),
- &place_pub_hash);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "place_disconnect, plc = %s\n",
- GNUNET_h2s (&place_pub_hash));
- place_cleanup (plc);
+ "%s left place %p\n",
+ plc->is_host ? "host" : "guest",
+ plc);
+ place_disconnect (plc);
}
GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER_ACK,
struct HostEnterAck,
hst),
+ GNUNET_MQ_hd_fixed_size (place_leave_ack,
+ GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE_ACK,
+ struct GNUNET_MessageHeader,
+ plc),
GNUNET_MQ_hd_var_size (host_enter_request,
GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST,
struct GNUNET_PSYC_JoinRequestMessage,
GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_ACK,
struct GNUNET_PSYC_CountersResultMessage,
gst),
+ GNUNET_MQ_hd_fixed_size (place_leave_ack,
+ GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE_ACK,
+ struct GNUNET_MessageHeader,
+ plc),
GNUNET_MQ_hd_var_size (guest_enter_decision,
GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION,
struct GNUNET_PSYC_JoinDecisionMessage,