gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33311 - gnunet/src/peerstore


From: gnunet
Subject: [GNUnet-SVN] r33311 - gnunet/src/peerstore
Date: Fri, 16 May 2014 19:23:47 +0200

Author: otarabai
Date: 2014-05-16 19:23:47 +0200 (Fri, 16 May 2014)
New Revision: 33311

Modified:
   gnunet/src/peerstore/peerstore_api.c
   gnunet/src/peerstore/peerstore_common.c
   gnunet/src/peerstore/test_peerstore_api.c
Log:
minor fixes


Modified: gnunet/src/peerstore/peerstore_api.c
===================================================================
--- gnunet/src/peerstore/peerstore_api.c        2014-05-16 17:00:30 UTC (rev 
33310)
+++ gnunet/src/peerstore/peerstore_api.c        2014-05-16 17:23:47 UTC (rev 
33311)
@@ -148,6 +148,21 @@
 }
 
 /**
+ * Should be called only after destroying MQ and connection
+ */
+static void
+cleanup_handle(struct GNUNET_PEERSTORE_Handle *h)
+{
+  struct GNUNET_PEERSTORE_StoreContext *sc;
+
+  while (NULL != (sc = h->store_head))
+  {
+    GNUNET_CONTAINER_DLL_remove(h->store_head, h->store_tail, sc);
+    GNUNET_free(sc);
+  }
+}
+
+/**
  * Close the existing connection to PEERSTORE and reconnect.
  *
  * @param h handle to the service
@@ -167,6 +182,7 @@
     GNUNET_CLIENT_disconnect (h->client);
     h->client = NULL;
   }
+  cleanup_handle(h);
   h->client = GNUNET_CLIENT_connect ("peerstore", h->cfg);
   h->mq = GNUNET_MQ_queue_for_connection_client(h->client,
       mq_handlers,
@@ -225,6 +241,7 @@
     GNUNET_CLIENT_disconnect (h->client);
     h->client = NULL;
   }
+  cleanup_handle(h);
   GNUNET_free(h);
   LOG(GNUNET_ERROR_TYPE_DEBUG, "Disconnected, BYE!\n");
 }

Modified: gnunet/src/peerstore/peerstore_common.c
===================================================================
--- gnunet/src/peerstore/peerstore_common.c     2014-05-16 17:00:30 UTC (rev 
33310)
+++ gnunet/src/peerstore/peerstore_common.c     2014-05-16 17:23:47 UTC (rev 
33311)
@@ -113,6 +113,7 @@
   size_t msg_size;
   void *dummy;
 
+  GNUNET_assert(NULL != sub_system);
   ss_size = strlen(sub_system) + 1;
   if(NULL == key)
     key_size = 0;

Modified: gnunet/src/peerstore/test_peerstore_api.c
===================================================================
--- gnunet/src/peerstore/test_peerstore_api.c   2014-05-16 17:00:30 UTC (rev 
33310)
+++ gnunet/src/peerstore/test_peerstore_api.c   2014-05-16 17:23:47 UTC (rev 
33311)
@@ -36,6 +36,7 @@
     ok = 0;
   else
     ok = 1;
+  printf("Success: %d\n", success);
   GNUNET_PEERSTORE_disconnect(h);
 }
 




reply via email to

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