summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-06-21 14:43:49 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-12-07 13:53:42 +0100
commit3e405fb188bee0bb8fcf91f574126771c8661afb (patch)
tree8b97fcbc1f5e9ff2e3f712f03185872bd72e949d
parentcc881bd15561224f507ed7162016114ed2b15a1e (diff)
Nest: Update to new timers
-rw-r--r--conf/conf.c10
-rw-r--r--conf/conf.h4
-rw-r--r--nest/proto.c9
-rw-r--r--sysdep/unix/main.c2
-rw-r--r--sysdep/unix/unix.h2
5 files changed, 13 insertions, 14 deletions
diff --git a/conf/conf.c b/conf/conf.c
index a570fad5..2b5e9c71 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -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)
{
diff --git a/conf/conf.h b/conf/conf.h
index 552d0120..12f51c9d 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -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);
diff --git a/nest/proto.c b/nest/proto.c
index 8d5edda3..27c8fded 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -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);
}
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 6cab21ac..e3252b43 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -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;
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h
index 4b0fb005..cb12fad8 100644
--- a/sysdep/unix/unix.h
+++ b/sysdep/unix/unix.h
@@ -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);