-round expiration times to full seconds
[oweals/gnunet.git] / src / fs / gnunet-service-fs.c
index 72fa662c1c78fb1c76ec7631d5f05a71e6a6b5db..a8fbda84bf99539af87909378f568eed4fa9c467 100644 (file)
@@ -202,7 +202,7 @@ GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start)
   struct GNUNET_TIME_Relative delay;
 
   delay = GNUNET_TIME_absolute_get_duration (start);
-  GNUNET_LOAD_update (datastore_get_load, delay.rel_value);
+  GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us);
 }
 
 
@@ -260,16 +260,16 @@ update_latencies (void *cls,
   {
     if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type))
       continue;
-    latency.rel_value = ntohl (ats[i].value);
+    latency.rel_value_us = ntohl (ats[i].value);
     GSF_update_peer_latency_ (&address->peer,
                              latency);
-    GSF_avg_latency.rel_value =
-      (GSF_avg_latency.rel_value * 31 +
+    GSF_avg_latency.rel_value_us =
+      (GSF_avg_latency.rel_value_us * 31 +
        GNUNET_MIN (5000, ntohl (ats[i].value))) / 32;
     GNUNET_STATISTICS_set (GSF_stats,
                           gettext_noop
                           ("# running average P2P latency (ms)"),
-                          GSF_avg_latency.rel_value, GNUNET_NO);
+                          GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO);
     break;    
   }
 }
@@ -475,7 +475,8 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client,
 static void
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GSF_mesh_stop ();
+  GSF_mesh_stop_client ();
+  GSF_mesh_stop_server ();
   if (NULL != GSF_core)
   {
     GNUNET_CORE_disconnect (GSF_core);
@@ -646,7 +647,8 @@ main_init (struct GNUNET_SERVER_Handle *server,
       GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters,
                                     NULL);
   datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE);
-  GSF_mesh_start ();
+  GSF_mesh_start_server ();
+  GSF_mesh_start_client ();
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
                                 NULL);
   return GNUNET_OK;
@@ -687,7 +689,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
   GSF_rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL);
   GSF_stats = GNUNET_STATISTICS_create ("fs", cfg);
   block_cfg = GNUNET_CONFIGURATION_create ();
-  GNUNET_CONFIGURATION_set_value_string (block_cfg, "block", "PLUGINS", "fs");
   GSF_block_ctx = GNUNET_BLOCK_context_create (block_cfg);
   GNUNET_assert (NULL != GSF_block_ctx);
   GSF_dht = GNUNET_DHT_connect (cfg, FS_DHT_HT_SIZE);