avoid failing hard if 'gnunetcheck' db does not exist
[oweals/gnunet.git] / src / nse / gnunet-service-nse.c
index 4d54a740b626e397d54bc2994e817b39c4626a70..b1f70214c1b574d2e9e2b6fe5af286e57329864d 100644 (file)
@@ -2,20 +2,20 @@
   This file is part of GNUnet.
   Copyright (C) 2009, 2010, 2011, 2012, 2013, 2016 GNUnet e.V.
 
-  GNUnet is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published
-  by the Free Software Foundation; either version 3, or (at your
-  option) any later version.
+  GNUnet is free software: you can redistribute it and/or modify it
+  under the terms of the GNU Affero General Public License as published
+  by the Free Software Foundation, either version 3 of the License,
+  or (at your option) any later version.
 
   GNUnet is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
+  Affero General Public License for more details.
+  You should have received a copy of the GNU Affero General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-  You should have received a copy of the GNU General Public License
-  along with GNUnet; see the file COPYING.  If not, write to the
-  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-  Boston, MA 02110-1301, USA.
+     SPDX-License-Identifier: AGPL3.0-or-later
  */
 
 /**
@@ -437,7 +437,7 @@ handle_start (void *cls,
   GNUNET_notification_context_add (nc,
                                   mq);
   setup_estimate_message (&em);
-  env = GNUNET_MQ_msg_copy (&em.header);       
+  env = GNUNET_MQ_msg_copy (&em.header);
   GNUNET_MQ_send (mq,
                  env);
   GNUNET_SERVICE_client_continue (client);
@@ -607,14 +607,14 @@ transmit_task_cb (void *cls)
   struct NSEPeerEntry *peer_entry = cls;
   unsigned int idx;
   struct GNUNET_MQ_Envelope *env;
-  
+
   peer_entry->transmit_task = NULL;
   idx = estimate_index;
   if (GNUNET_NO == peer_entry->previous_round)
   {
     idx = (idx + HISTORY_SIZE - 1) % HISTORY_SIZE;
     peer_entry->previous_round = GNUNET_YES;
-    peer_entry->transmit_task 
+    peer_entry->transmit_task
       = GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0),
                                      &transmit_task_cb,
                                      peer_entry);
@@ -652,12 +652,12 @@ transmit_task_cb (void *cls)
                             GNUNET_NO);
 #if ENABLE_NSE_HISTOGRAM
   peer_entry->transmitted_messages++;
-  peer_entry->last_transmitted_size 
+  peer_entry->last_transmitted_size
     = ntohl(size_estimate_messages[idx].matching_bits);
 #endif
   env = GNUNET_MQ_msg_copy (&size_estimate_messages[idx].header);
   GNUNET_MQ_send (peer_entry->mq,
-                 env);  
+                 env);
 }
 
 
@@ -811,11 +811,10 @@ update_flood_message (void *cls)
   GNUNET_CONTAINER_multipeermap_iterate (peers,
                                          &schedule_current_round,
                                          NULL);
-  flood_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
-                                    (next_timestamp),
-                                   &update_flood_message,
-                                    NULL);
+  flood_task
+    = GNUNET_SCHEDULER_add_at (next_timestamp,
+                               &update_flood_message,
+                               NULL);
 }
 
 
@@ -1012,7 +1011,7 @@ update_flood_times (void *cls,
   {
     /* still stuck in previous round, no point to update, check that
      * we are active here though... */
-    if (NULL == peer_entry->transmit_task) 
+    if (NULL == peer_entry->transmit_task)
     {
       GNUNET_break (0);
     }
@@ -1034,7 +1033,7 @@ update_flood_times (void *cls,
 /**
  * Core handler for size estimate flooding messages.
  *
- * @param cls peer this message is from 
+ * @param cls peer this message is from
  * @param incoming_flood received message
  */
 static void
@@ -1169,7 +1168,7 @@ handle_p2p_estimate (void *cls,
     /* push back our result now, that peer is spreading bad information... */
     if (NULL != peer_entry->transmit_task)
       GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
-    peer_entry->transmit_task 
+    peer_entry->transmit_task
       = GNUNET_SCHEDULER_add_now (&transmit_task_cb,
                                  peer_entry);
     /* Not closer than our most recent message, no need to do work here */
@@ -1431,11 +1430,10 @@ core_init (void *cls,
                         current_timestamp);
     estimate_count++;
   }
-  flood_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
-                                    (next_timestamp),
-                                   &update_flood_message,
-                                    NULL);
+  flood_task
+    = GNUNET_SCHEDULER_add_at (next_timestamp,
+                               &update_flood_message,
+                               NULL);
 }