fixes
[oweals/gnunet.git] / src / datastore / gnunet-service-datastore.c
index 48b45894bd8ac0c809452be4e8af10e4e152eecf..a2e8aa8206adde0c8411de3a7cfcc66f1480d9d8 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
 #include "gnunet_protocols.h"
 #include "gnunet_statistics_service.h"
 #include "plugin_datastore.h"
@@ -242,7 +241,7 @@ static struct TransmitCallbackContext *tcc_head;
 static struct TransmitCallbackContext *tcc_tail;
 
 /**
- * Have we already clean ed up the TCCs and are hence no longer
+ * Have we already cleaned up the TCCs and are hence no longer
  * willing (or able) to transmit anything to anyone?
  */
 static int cleaning_done;
@@ -288,7 +287,7 @@ expired_processor (void *cls,
                   const GNUNET_HashCode * key,
                   uint32_t size,
                   const void *data,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   uint32_t priority,
                   uint32_t anonymity,
                   struct GNUNET_TIME_Absolute
@@ -322,7 +321,7 @@ expired_processor (void *cls,
   GNUNET_STATISTICS_update (stats,
                            gettext_noop ("# bytes expired"),
                            size,
-                           GNUNET_NO);
+                           GNUNET_YES);
   GNUNET_CONTAINER_bloomfilter_remove (filter,
                                       key);
   return GNUNET_NO; /* delete */
@@ -375,7 +374,7 @@ manage (void *cls,
        const GNUNET_HashCode * key,
        uint32_t size,
        const void *data,
-       uint32_t type,
+       enum GNUNET_BLOCK_Type type,
        uint32_t priority,
        uint32_t anonymity,
        struct GNUNET_TIME_Absolute
@@ -404,7 +403,7 @@ manage (void *cls,
   GNUNET_STATISTICS_update (stats,
                            gettext_noop ("# bytes purged (low-priority)"),
                            size,
-                           GNUNET_NO);
+                           GNUNET_YES);
   GNUNET_CONTAINER_bloomfilter_remove (filter,
                                       key);
   return GNUNET_NO;
@@ -524,6 +523,11 @@ transmit (struct GNUNET_SERVER_Client *client,
 
   if (GNUNET_YES == cleaning_done)
     {
+#if DEBUG_DATASTORE
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                 "Shutdown in progress, aborting transmission.\n");
+#endif
+      GNUNET_free (msg);
       if (NULL != tc)
        tc (tc_cls, GNUNET_SYSERR);
       return;
@@ -644,7 +648,7 @@ transmit_item (void *cls,
               const GNUNET_HashCode * key,
               uint32_t size,
               const void *data,
-              uint32_t type,
+              enum GNUNET_BLOCK_Type type,
               uint32_t priority,
               uint32_t anonymity,
               struct GNUNET_TIME_Absolute
@@ -916,7 +920,7 @@ handle_put (void *cls,
       GNUNET_STATISTICS_update (stats,
                                gettext_noop ("# bytes stored"),
                                size,
-                               GNUNET_NO);
+                               GNUNET_YES);
       GNUNET_CONTAINER_bloomfilter_add (filter,
                                        &dm->key);
 #if DEBUG_DATASTORE
@@ -1094,7 +1098,7 @@ remove_callback (void *cls,
                 const GNUNET_HashCode * key,
                 uint32_t size,
                 const void *data,
-                uint32_t type,
+                enum GNUNET_BLOCK_Type type,
                 uint32_t priority,
                 uint32_t anonymity,
                 struct GNUNET_TIME_Absolute
@@ -1128,7 +1132,7 @@ remove_callback (void *cls,
   GNUNET_STATISTICS_update (stats,
                            gettext_noop ("# bytes removed (explicit request)"),
                            size,
-                           GNUNET_NO);
+                           GNUNET_YES);
   GNUNET_CONTAINER_bloomfilter_remove (filter,
                                       key);
   plugin->api->next_request (next_cls, GNUNET_YES);
@@ -1304,7 +1308,6 @@ unload_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       GNUNET_CONTAINER_bloomfilter_free (filter);
       filter = NULL;
     }
-  GNUNET_ARM_stop_services (cfg, tc->sched, "statistics", NULL);
   if (stats != NULL)
     {
       GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
@@ -1333,7 +1336,7 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
          GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th);
          GNUNET_SERVER_client_drop (tcc->client);
        }
-   if (NULL != tcc->tc)
+      if (NULL != tcc->tc)
        tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
       GNUNET_free (tcc->msg);
       GNUNET_free (tcc);
@@ -1453,13 +1456,11 @@ run (void *cls,
        }
       return;
     }
-  GNUNET_ARM_start_services (cfg, sched, "statistics", NULL);
   plugin = load_plugin ();
   if (NULL == plugin)
     {
       GNUNET_CONTAINER_bloomfilter_free (filter);
       filter = NULL;
-      GNUNET_ARM_stop_services (cfg, sched, "statistics", NULL);
       if (stats != NULL)
        {
          GNUNET_STATISTICS_destroy (stats, GNUNET_YES);