added logging
[oweals/gnunet.git] / src / social / social_api.c
index af1d6e57eeb919aa6050f5eb9e4c7de280dd757b..923ab5e33b3b0c2743aea54f1b22c342eca6e12b 100644 (file)
@@ -818,6 +818,9 @@ handle_host_enter_request (void *cls,
 {
   struct GNUNET_SOCIAL_Host *hst = cls;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "handle_host_enter_request\n");
+
   if (NULL == hst->answer_door_cb)
      return;
 
@@ -1042,7 +1045,7 @@ 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_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "%s place cleanup: %s\n",
               GNUNET_YES == plc->is_host ? "host" : "guest",
               GNUNET_h2s (&place_pub_hash));
@@ -1059,6 +1062,8 @@ place_cleanup (struct GNUNET_SOCIAL_Place *plc)
   }
   if (NULL != plc->mq)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "destroying MQ (place_cleanup)\n");
     GNUNET_MQ_destroy (plc->mq);
     plc->mq = NULL;
   }
@@ -1075,13 +1080,13 @@ place_cleanup (struct GNUNET_SOCIAL_Place *plc)
 
 
 void
-place_disconnect (struct GNUNET_SOCIAL_Place *plc,
-                  GNUNET_ContinuationCallback cb,
-                  void *cls)
+place_disconnect (struct GNUNET_SOCIAL_Place *plc)
 {
-  plc->disconnect_cb = cb;
-  plc->disconnect_cls = cls;
-
+  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));
   if (NULL != plc->mq)
   {
     struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq);
@@ -1104,6 +1109,8 @@ place_disconnect (struct GNUNET_SOCIAL_Place *plc,
 void
 place_leave (struct GNUNET_SOCIAL_Place *plc)
 {
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "social_api: place_leave\n");
   struct GNUNET_MessageHeader *msg;
   struct GNUNET_MQ_Envelope *
     env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
@@ -1147,6 +1154,8 @@ host_disconnected (void *cls, enum GNUNET_MQ_Error error)
   }
   if (NULL != plc->mq)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "destroying MQ (host_disconnected)\n");
     GNUNET_MQ_destroy (plc->mq);
     plc->mq = NULL;
   }
@@ -1580,7 +1589,11 @@ GNUNET_SOCIAL_host_disconnect (struct GNUNET_SOCIAL_Host *hst,
                                GNUNET_ContinuationCallback disconnect_cb,
                                void *cls)
 {
-  place_disconnect (&hst->plc, disconnect_cb, cls);
+  struct GNUNET_SOCIAL_Place *plc = &hst->plc; 
+
+  plc->disconnect_cb = disconnect_cb;
+  plc->disconnect_cls = cls;
+  place_disconnect (plc);
 }
 
 
@@ -1607,6 +1620,8 @@ GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *hst,
                           GNUNET_ContinuationCallback disconnect_cb,
                           void *cls)
 {
+  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);
   place_leave (&hst->plc);
@@ -1649,6 +1664,8 @@ guest_disconnected (void *cls, enum GNUNET_MQ_Error error)
   }
   if (NULL != plc->mq)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "destroying MQ (guest_disconnected)\n");
     GNUNET_MQ_destroy (plc->mq);
     plc->mq = NULL;
   }
@@ -2028,7 +2045,14 @@ GNUNET_SOCIAL_guest_disconnect (struct GNUNET_SOCIAL_Guest *gst,
                                 GNUNET_ContinuationCallback disconnect_cb,
                                 void *cls)
 {
-  place_disconnect (&gst->plc, disconnect_cb, cls);
+  struct GNUNET_SOCIAL_Place *plc = &gst->plc;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "GNUNET_SOCIAL_guest_disconnect, gst = %p\n",
+              gst);
+  plc->disconnect_cb = disconnect_cb;
+  plc->disconnect_cls = cls;
+  place_disconnect (plc);
 }