use new SCHEDULER_add_at API where applicable
authorChristian Grothoff <christian@grothoff.org>
Sat, 21 Jan 2017 23:46:03 +0000 (00:46 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 21 Jan 2017 23:46:03 +0000 (00:46 +0100)
src/cadet/gnunet-service-cadet-new_tunnels.c
src/core/gnunet-service-core_sessions.c
src/dht/gnunet-service-dht_clients.c
src/fragmentation/fragmentation.c
src/fs/gnunet-service-fs_pe.c
src/nse/gnunet-service-nse.c
src/topology/gnunet-daemon-topology.c
src/transport/gnunet-service-transport_manipulation.c
src/transport/gnunet-service-transport_neighbours.c

index 111adffde486d78aba3963d5597990491afe0f71..178577b46a157023aae91731bc0a94978ef3c55f 100644 (file)
@@ -1673,9 +1673,9 @@ connection_ready_cb (void *cls,
     if (NULL == t->kx_task)
     {
       t->kx_task
-        = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (t->next_kx_attempt),
-                                        &retry_kx,
-                                        t);
+        = GNUNET_SCHEDULER_add_at (t->next_kx_attempt,
+                                   &retry_kx,
+                                   t);
     }
     break;
   case CADET_TUNNEL_KEY_OK:
index 036fd1425ff0c2bfd6b5fdc78117cb8c87cf9aa1..6687b4819dc338848bfa95af4cd5bfa9c51ccad4 100644 (file)
@@ -90,9 +90,9 @@ struct Session
 
   /**
    * Key exchange state for this peer.
-   */ 
+   */
   struct GSC_KeyExchangeInfo *kx;
-  
+
   /**
    * Head of list of requests from clients for transmission to
    * this peer.
@@ -725,10 +725,10 @@ try_transmission (struct Session *session)
                                                           GNUNET_YES));
       if (NULL != session->cork_task)
         GNUNET_SCHEDULER_cancel (session->cork_task);
-      session->cork_task =
-          GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (min_deadline),
-                                        &pop_cork_task,
-                                        session);
+      session->cork_task
+        = GNUNET_SCHEDULER_add_at (min_deadline,
+                                   &pop_cork_task,
+                                   session);
     }
     else
     {
index df56c010a57c7b1ed61c4fadb14f6a2805fd80e3..5ba4e5820a5d98657de8aed92495910aecd9bab1 100644 (file)
@@ -426,19 +426,20 @@ transmit_next_request_task (void *cls)
     delay = GNUNET_TIME_absolute_get_remaining (cqr->retry_time);
     if (delay.rel_value_us > 0)
     {
-      cqr->hnode =
-          GNUNET_CONTAINER_heap_insert (retry_heap,
+      cqr->hnode
+        = GNUNET_CONTAINER_heap_insert (retry_heap,
                                         cqr,
                                         cqr->retry_time.abs_value_us);
-      retry_task =
-          GNUNET_SCHEDULER_add_delayed (delay,
-                                        &transmit_next_request_task,
-                                        NULL);
+      retry_task
+        = GNUNET_SCHEDULER_add_at (cqr->retry_time,
+                                   &transmit_next_request_task,
+                                   NULL);
       return;
     }
     transmit_request (cqr);
     cqr->hnode
-      = GNUNET_CONTAINER_heap_insert (retry_heap, cqr,
+      = GNUNET_CONTAINER_heap_insert (retry_heap,
+                                      cqr,
                                       cqr->retry_time.abs_value_us);
   }
 }
index 02444cf14f9706e9039cf8a5337dff92ba12bb70..f686351004171c94c118610a522277d34f5174f9 100644 (file)
@@ -373,8 +373,9 @@ GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc)
   fc->proc_busy = GNUNET_NO;
   GNUNET_assert (fc->task == NULL);
   fc->task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
-                                    (fc->delay_until), &transmit_next, fc);
+    GNUNET_SCHEDULER_add_at (fc->delay_until,
+                             &transmit_next,
+                             fc);
 }
 
 
index e8ce77904ea36b5c42bb51d78559f96da74138d6..12b04dcd193ff81a3e1187ed595efe04bfb93227 100644 (file)
@@ -427,10 +427,10 @@ schedule_peer_transmission (void *cls)
                            gettext_noop ("# delay heap timeout (ms)"),
                            delay.rel_value_us / 1000LL, GNUNET_NO);
 
-    pp->task =
-        GNUNET_SCHEDULER_add_delayed (delay,
-                                      &schedule_peer_transmission,
-                                      pp);
+    pp->task
+      = GNUNET_SCHEDULER_add_at (rp->earliest_transmission,
+                                 &schedule_peer_transmission,
+                                 pp);
     return;
   }
 #if INSANE_STATISTICS
index 4d54a740b626e397d54bc2994e817b39c4626a70..e35115e31deaca9fb1e8eaa1df838603db70f4eb 100644 (file)
@@ -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);
 }
 
 
index d48f07e719da09f813b200caa26979994c93ee3a..067ebce238890b34cbaffd2abb3c3890065bea5c 100644 (file)
@@ -534,10 +534,10 @@ schedule_next_hello (void *cls)
                            1,
                            GNUNET_NO);
   /* prepare to send the next one */
-  if (NULL != pl->hello_delay_task)
-    GNUNET_SCHEDULER_cancel (pl->hello_delay_task);
   pl->next_hello_allowed
     = GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY);
+  if (NULL != pl->hello_delay_task)
+    GNUNET_SCHEDULER_cancel (pl->hello_delay_task);
   pl->hello_delay_task
     = GNUNET_SCHEDULER_add_now (&schedule_next_hello,
                                pl);
@@ -1022,7 +1022,7 @@ check_hello (void *cls,
             const struct GNUNET_HELLO_Message *message)
 {
   struct GNUNET_PeerIdentity pid;
-    
+
   if (GNUNET_OK !=
       GNUNET_HELLO_get_id (message,
                           &pid))
index f198d6e49e417893f5577149a3253d166108a99e..e68753583f40cde5b6e5d9ddbb4551e5729066b6 100644 (file)
@@ -219,7 +219,6 @@ send_delayed (void *cls)
   struct DelayQueueEntry *dqe = cls;
   struct DelayQueueEntry *next;
   struct TM_Peer *tmp = dqe->tmp;
-  struct GNUNET_TIME_Relative delay;
 
   GNUNET_break (GNUNET_YES ==
                 GST_neighbours_test_connected (&dqe->id));
@@ -233,9 +232,9 @@ send_delayed (void *cls)
     if (NULL != next)
     {
       /* More delayed messages */
-      delay = GNUNET_TIME_absolute_get_remaining(next->sent_at);
-      tmp->send_delay_task = GNUNET_SCHEDULER_add_delayed(delay,
-                                                          &send_delayed, next);
+      tmp->send_delay_task = GNUNET_SCHEDULER_add_at (next->sent_at,
+                                                      &send_delayed,
+                                                      next);
     }
   }
   else
@@ -249,10 +248,9 @@ send_delayed (void *cls)
     if (NULL != next)
     {
       /* More delayed messages */
-      delay = GNUNET_TIME_absolute_get_remaining(next->sent_at);
-      generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay,
-                                                              &send_delayed,
-                                                              next);
+      generic_send_delay_task = GNUNET_SCHEDULER_add_at (next->sent_at,
+                                                         &send_delayed,
+                                                         next);
     }
   }
   GST_neighbours_send (&dqe->id,
@@ -503,9 +501,9 @@ GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer)
     generic_send_delay_task = NULL;
     if (NULL != generic_dqe_head)
       generic_send_delay_task
-        = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining(generic_dqe_head->sent_at),
-                                        &send_delayed,
-                                        generic_dqe_head);
+        = GNUNET_SCHEDULER_add_at (generic_dqe_head->sent_at,
+                                   &send_delayed,
+                                   generic_dqe_head);
   }
 }
 
index e1e4f56f801efe3b22247dd2172deedecc7707ae..3952a728e6c4bd26fa8ee54bc156c76a622405fa 100644 (file)
@@ -735,9 +735,9 @@ set_state_and_timeout (struct NeighbourMapEntry *n,
   {
     /* new timeout is earlier, reschedule master task */
     GNUNET_SCHEDULER_cancel (n->task);
-    n->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (timeout),
-                                            &master_task,
-                                            n);
+    n->task = GNUNET_SCHEDULER_add_at (timeout,
+                                       &master_task,
+                                       n);
   }
   n->timeout = timeout;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,