Commit 95893fa1 authored by Daniel Salzman's avatar Daniel Salzman

ctl: update ctl.timeout without server restart

parent b2838e61
......@@ -136,6 +136,9 @@ static void init_cache(
val = conf_get(conf, C_SRV, C_RATE_LIMIT_SLIP);
conf->cache.srv_rate_limit_slip = conf_int(&val);
val = conf_get(conf, C_CTL, C_TIMEOUT);
conf->cache.ctl_timeout = conf_int(&val) * 1000;
conf->cache.srv_nsid = conf_get(conf, C_SRV, C_NSID);
conf->cache.srv_rate_limit_whitelist = conf_get(conf, C_SRV, C_RATE_LIMIT_WHITELIST);
......
......@@ -98,6 +98,7 @@ typedef struct {
int32_t srv_tcp_reply_timeout;
int32_t srv_max_tcp_clients;
int32_t srv_rate_limit_slip;
int32_t ctl_timeout;
conf_val_t srv_nsid;
conf_val_t srv_rate_limit_whitelist;
} cache;
......
......@@ -130,7 +130,7 @@ static const yp_item_t desc_server[] = {
static const yp_item_t desc_control[] = {
{ C_LISTEN, YP_TSTR, YP_VSTR = { "knot.sock" } },
{ C_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX, 5, YP_STIME } },
{ C_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX / 1000, 5, YP_STIME } },
{ C_COMMENT, YP_TSTR, YP_VNONE },
{ NULL }
};
......
......@@ -234,8 +234,7 @@ static void event_loop(server_t *server, char *socket)
}
// Set control timeout.
conf_val_t val = conf_get(conf(), C_CTL, C_TIMEOUT);
knot_ctl_set_timeout(ctl, conf_int(&val) * 1000);
knot_ctl_set_timeout(ctl, conf()->cache.ctl_timeout);
log_info("control, binding to '%s'", listen);
......@@ -265,6 +264,9 @@ static void event_loop(server_t *server, char *socket)
server_reload(server, conf()->filename, true);
}
// Update control timeout.
knot_ctl_set_timeout(ctl, conf()->cache.ctl_timeout);
ret = knot_ctl_accept(ctl);
if (ret != KNOT_EOK) {
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment