diff --git a/src/knot/conf/base.c b/src/knot/conf/base.c index da3b74261821a7dd63a25330d2e74c451c8aeefb..86c9ead221c5f6da44d33018b6a80625afc00422 100644 --- a/src/knot/conf/base.c +++ b/src/knot/conf/base.c @@ -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); diff --git a/src/knot/conf/base.h b/src/knot/conf/base.h index fc346d00e38dd564a53ed79f10db8c002ee7a7d9..cd878861bda2b6bc6858a1e2e15d518f3527af31 100644 --- a/src/knot/conf/base.h +++ b/src/knot/conf/base.h @@ -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; diff --git a/src/knot/conf/scheme.c b/src/knot/conf/scheme.c index 3b445f6c36f8eddaaf2930f4084ddcd71a2b2eba..2a074fa4c0e416d11dd50137994e4e6672b35c7d 100644 --- a/src/knot/conf/scheme.c +++ b/src/knot/conf/scheme.c @@ -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 } }; diff --git a/src/utils/knotd/main.c b/src/utils/knotd/main.c index a45ab2d4848d1a7b0fdfa8d417c32d497f89ee40..c9a35c1efef7021c2e52e930ba0157d53ba7b9ce 100644 --- a/src/utils/knotd/main.c +++ b/src/utils/knotd/main.c @@ -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;