]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Update to new timers
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 21 Jun 2017 12:43:49 +0000 (14:43 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Thu, 7 Dec 2017 12:53:42 +0000 (13:53 +0100)
conf/conf.c
conf/conf.h
nest/proto.c
sysdep/unix/main.c
sysdep/unix/unix.h

index a570fad575bc855a0ac86ff162bda04945f6ea38..2b5e9c7169ad02bc6983afd1f331555824a4920c 100644 (file)
@@ -307,7 +307,7 @@ config_done(void *unused UNUSED)
  * config_commit - commit a configuration
  * @c: new configuration
  * @type: type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD)
- * @timeout: timeout for undo (or 0 for no timeout)
+ * @timeout: timeout for undo (in seconds; or 0 for no timeout)
  *
  * When a configuration is parsed and prepared for use, the
  * config_commit() function starts the process of reconfiguration.
@@ -331,7 +331,7 @@ config_done(void *unused UNUSED)
  * are accepted.
  */
 int
-config_commit(struct config *c, int type, int timeout)
+config_commit(struct config *c, int type, uint timeout)
 {
   if (shutting_down)
     {
@@ -340,10 +340,10 @@ config_commit(struct config *c, int type, int timeout)
     }
 
   undo_available = 1;
-  if (timeout > 0)
-    tm_start(config_timer, timeout);
+  if (timeout)
+    tm2_start(config_timer, timeout S);
   else
-    tm_stop(config_timer);
+    tm2_stop(config_timer);
 
   if (configuring)
     {
index 552d0120f0871e875f06c46493ad9912a982bfc4..12f51c9d3eb56630c2067604ab34cacddd80d202 100644 (file)
@@ -41,7 +41,7 @@ struct config {
   struct timeformat tf_proto;          /* Time format for 'show protocol' */
   struct timeformat tf_log;            /* Time format for the logfile */
   struct timeformat tf_base;           /* Time format for other purposes */
-  u32 gr_wait;                         /* Graceful restart wait timeout */
+  u32 gr_wait;                         /* Graceful restart wait timeout (sec) */
 
   int cli_debug;                       /* Tracing of CLI connections and commands */
   int latency_debug;                   /* I/O loop tracks duration of each event */
@@ -68,7 +68,7 @@ struct config *config_alloc(const char *name);
 int config_parse(struct config *);
 int cli_parse(struct config *);
 void config_free(struct config *);
-int config_commit(struct config *, int type, int timeout);
+int config_commit(struct config *, int type, uint timeout);
 int config_confirm(void);
 int config_undo(void);
 void config_init(void);
index 8d5edda3dd058fb2daa0216a12e7b9857a97361b..27c8fdedea208800825cd766c04d4195a8671123 100644 (file)
@@ -1083,9 +1083,8 @@ graceful_restart_init(void)
   }
 
   graceful_restart_state = GRS_ACTIVE;
-  gr_wait_timer = tm_new(proto_pool);
-  gr_wait_timer->hook = graceful_restart_done;
-  tm_start(gr_wait_timer, config->gr_wait);
+  gr_wait_timer = tm2_new_init(proto_pool, graceful_restart_done, NULL, 0, 0);
+  tm2_start(gr_wait_timer, config->gr_wait S);
 }
 
 /**
@@ -1182,7 +1181,7 @@ channel_graceful_restart_unlock(struct channel *c)
   graceful_restart_locks--;
 
   if ((graceful_restart_state == GRS_ACTIVE) && !graceful_restart_locks)
-    tm_start(gr_wait_timer, 0);
+    tm2_start(gr_wait_timer, 0);
 }
 
 
@@ -1329,7 +1328,7 @@ proto_schedule_down(struct proto *p, byte restart, byte code)
 
   p->down_sched = restart ? PDS_RESTART : PDS_DISABLE;
   p->down_code = code;
-  tm_start_max(proto_shutdown_timer, restart ? 2 : 0);
+  tm2_start_max(proto_shutdown_timer, restart ? 250 MS : 0);
 }
 
 
index 6cab21ac1c0d98471dd91c00ffc60425da1e17ff..e3252b436faf7404c6d8adaa326c3a9f2f279396 100644 (file)
@@ -303,7 +303,7 @@ cmd_reconfig_undo_notify(void)
 }
 
 void
-cmd_reconfig(char *name, int type, int timeout)
+cmd_reconfig(char *name, int type, uint timeout)
 {
   if (cli_access_restricted())
     return;
index 4b0fb0050ea9fade9e1ab9a87e0e54399726f330..cb12fad844bb65da77b3d95960e982e0452ca817 100644 (file)
@@ -22,7 +22,7 @@ void async_config(void);
 void async_dump(void);
 void async_shutdown(void);
 void cmd_check_config(char *name);
-void cmd_reconfig(char *name, int type, int timeout);
+void cmd_reconfig(char *name, int type, uint timeout);
 void cmd_reconfig_confirm(void);
 void cmd_reconfig_undo(void);
 void cmd_shutdown(void);