Commit a1950934 authored by Daniel Salzman's avatar Daniel Salzman

conf: rename connection timeout items

max-conn-{handshake,idle,reply} -> tcp-{handshake,idle,reply}-timeout
parent a6f174ac
......@@ -117,9 +117,9 @@ server:
workers: INT
background\-workers: INT
async\-start: BOOL
max\-conn\-idle: TIME
max\-conn\-handshake: TIME
max\-conn\-reply: TIME
tcp\-idle\-timeout: TIME
tcp\-handshake\-timeout: TIME
tcp\-reply\-timeout: TIME
max\-tcp\-clients: INT
max\-udp\-payload: SIZE
transfers: INT
......@@ -184,20 +184,20 @@ If enabled, server doesn\(aqt wait for the zones to be loaded and starts
responding immediately with SERVFAIL answers until the zone loads.
.sp
Default: off
.SS max\-conn\-idle
.SS tcp\-idle\-timeout
.sp
Maximum idle time between requests on a TCP connection. This also limits
receiving of a single query, each query must be received in this time limit.
.sp
Default: 20
.SS max\-conn\-handshake
.SS tcp\-handshake\-timeout
.sp
Maximum time between newly accepted TCP connection and the first query.
This is useful to disconnect inactive connections faster than connections
that already made at least 1 meaningful query.
.sp
Default: 5
.SS max\-conn\-reply
.SS tcp\-reply\-timeout
.sp
Maximum time to wait for a reply to an issued SOA query.
.sp
......
......@@ -86,9 +86,9 @@ General options related to the server.
workers: INT
background-workers: INT
async-start: BOOL
max-conn-idle: TIME
max-conn-handshake: TIME
max-conn-reply: TIME
tcp-idle-timeout: TIME
tcp-handshake-timeout: TIME
tcp-reply-timeout: TIME
max-tcp-clients: INT
max-udp-payload: SIZE
transfers: INT
......@@ -186,20 +186,20 @@ responding immediately with SERVFAIL answers until the zone loads.
Default: off
.. _server_max-conn-idle:
.. _server_tcp-idle-timeout:
max-conn-idle
-------------
tcp-idle-timeout
----------------
Maximum idle time between requests on a TCP connection. This also limits
receiving of a single query, each query must be received in this time limit.
Default: 20
.. _server_max-conn-handshake:
.. _server_tcp-handshake-timeout:
max-conn-handshake
------------------
tcp-handshake-timeout
---------------------
Maximum time between newly accepted TCP connection and the first query.
This is useful to disconnect inactive connections faster than connections
......@@ -207,10 +207,10 @@ that already made at least 1 meaningful query.
Default: 5
.. _server_max-conn-reply:
.. _server_tcp-reply-timeout:
max-conn-reply
--------------
tcp-reply-timeout
-----------------
Maximum time to wait for a reply to an issued SOA query.
......
......@@ -81,9 +81,9 @@ static const yp_item_t desc_server[] = {
{ C_WORKERS, YP_TINT, YP_VINT = { 1, 255, YP_NIL } },
{ C_BG_WORKERS, YP_TINT, YP_VINT = { 1, 255, YP_NIL } },
{ C_ASYNC_START, YP_TBOOL, YP_VNONE },
{ C_MAX_CONN_IDLE, YP_TINT, YP_VINT = { 0, INT32_MAX, 20, YP_STIME } },
{ C_MAX_CONN_HANDSHAKE, YP_TINT, YP_VINT = { 0, INT32_MAX, 5, YP_STIME } },
{ C_MAX_CONN_REPLY, YP_TINT, YP_VINT = { 0, INT32_MAX, 10, YP_STIME } },
{ C_TCP_HSHAKE_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX, 5, YP_STIME } },
{ C_TCP_REPLY_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX, 10, YP_STIME } },
{ C_TCP_IDLE_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX, 20, YP_STIME } },
{ C_MAX_TCP_CLIENTS, YP_TINT, YP_VINT = { 0, INT32_MAX, 100 } },
{ C_MAX_UDP_PAYLOAD, YP_TINT, YP_VINT = { KNOT_EDNS_MIN_UDP_PAYLOAD,
KNOT_EDNS_MAX_UDP_PAYLOAD,
......
......@@ -50,9 +50,6 @@
#define C_LISTEN "\x06""listen"
#define C_LOG "\x03""log"
#define C_MASTER "\x06""master"
#define C_MAX_CONN_HANDSHAKE "\x12""max-conn-handshake"
#define C_MAX_CONN_IDLE "\x0D""max-conn-idle"
#define C_MAX_CONN_REPLY "\x0E""max-conn-reply"
#define C_MAX_JOURNAL_SIZE "\x10""max-journal-size"
#define C_MAX_TCP_CLIENTS "\x0F""max-tcp-clients"
#define C_MAX_UDP_PAYLOAD "\x0F""max-udp-payload"
......@@ -72,6 +69,9 @@
#define C_SRV "\x06""server"
#define C_STORAGE "\x07""storage"
#define C_TARGET "\x06""target"
#define C_TCP_HSHAKE_TIMEOUT "\x15""tcp-handshake-timeout"
#define C_TCP_IDLE_TIMEOUT "\x10""tcp-idle-timeout"
#define C_TCP_REPLY_TIMEOUT "\x11""tcp-reply-timeout"
#define C_TPL "\x08""template"
#define C_TRANSFERS "\x09""transfers"
#define C_USER "\x04""user"
......
......@@ -260,7 +260,7 @@ static int cmd_remote(struct sockaddr_storage *addr, knot_tsig_key_t *key,
/* Wait for availability. */
struct pollfd pfd = { s, POLLOUT, 0 };
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
if (poll(&pfd, 1, conf_int(&val)) != 1) {
log_error("failed to connect to remote host '%s'", addr_str);
close(s);
......
......@@ -506,7 +506,7 @@ static int remote_c_signzone(server_t *s, remote_cmdargs_t* a)
static int remote_senderr(int c, uint8_t *qbuf, size_t buflen)
{
rcu_read_lock();
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
struct timeval timeout = { conf_int(&val), 0 };
rcu_read_unlock();
......@@ -652,7 +652,7 @@ static int remote_send_chunk(int c, knot_pkt_t *query, const char* d, uint16_t l
}
rcu_read_lock();
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
struct timeval timeout = { conf_int(&val), 0 };
rcu_read_unlock();
......
......@@ -71,7 +71,7 @@ static int dnsproxy_fwd(int state, knot_pkt_t *pkt, struct query_data *qdata, vo
/* Forward request. */
ret = knot_requestor_enqueue(&re, req);
if (ret == KNOT_EOK) {
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_HANDSHAKE);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_HSHAKE_TIMEOUT);
struct timeval tv = { conf_int(&val), 0 };
ret = knot_requestor_exec(&re, &tv);
} else {
......
......@@ -384,7 +384,7 @@ static int forward_request(zone_t *zone, struct knot_request *request)
/* Enqueue and execute request. */
ret = knot_requestor_enqueue(&re, req);
if (ret == KNOT_EOK) {
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
struct timeval tv = { conf_int(&val), 0 };
ret = knot_requestor_exec(&re, &tv);
}
......@@ -454,7 +454,7 @@ static void send_update_response(const zone_t *zone, struct knot_request *req)
}
if (net_is_connected(req->fd)) {
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
struct timeval timeout = { conf_int(&val), 0 };
tcp_send_msg(req->fd, req->resp->wire, req->resp->size,
&timeout);
......
......@@ -113,7 +113,7 @@ static int tcp_handle(tcp_context_t *tcp, int fd,
/* Timeout. */
rcu_read_lock();
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
int64_t max_conn_reply = conf_int(&val);
rcu_read_unlock();
struct timeval tmout = { max_conn_reply, 0 };
......@@ -191,7 +191,7 @@ int tcp_accept(int fd)
#ifdef SO_RCVTIMEO
struct timeval tv;
rcu_read_lock();
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_IDLE);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_IDLE_TIMEOUT);
tv.tv_sec = conf_int(&val);
rcu_read_unlock();
tv.tv_usec = 0;
......@@ -220,7 +220,7 @@ static int tcp_event_accept(tcp_context_t *tcp, unsigned i)
/* Update watchdog timer. */
rcu_read_lock();
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_HANDSHAKE);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_HSHAKE_TIMEOUT);
fdset_set_watchdog(&tcp->set, next_id, conf_int(&val));
rcu_read_unlock();
......@@ -241,7 +241,7 @@ static int tcp_event_serve(tcp_context_t *tcp, unsigned i)
if (ret == KNOT_EOK) {
/* Update socket activity timer. */
rcu_read_lock();
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_IDLE);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_IDLE_TIMEOUT);
fdset_set_watchdog(&tcp->set, i, conf_int(&val));
rcu_read_unlock();
}
......
......@@ -137,7 +137,7 @@ static int zone_query_execute(zone_t *zone, uint16_t pkt_type, const conf_remote
/* Send the queries and process responses. */
ret = knot_requestor_enqueue(&re, req);
if (ret == KNOT_EOK) {
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_REPLY);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_REPLY_TIMEOUT);
struct timeval tv = { conf_int(&val), 0 };
ret = knot_requestor_exec(&re, &tv);
}
......@@ -219,7 +219,7 @@ static uint32_t soa_graceful_expire(const knot_rdataset_t *soa)
{
// Allow for timeouts. Otherwise zones with very short
// expiry may expire before the timeout is reached.
conf_val_t val = conf_get(conf(), C_SRV, C_MAX_CONN_IDLE);
conf_val_t val = conf_get(conf(), C_SRV, C_TCP_IDLE_TIMEOUT);
return knot_soa_expire(soa) + 2 * conf_int(&val);
}
......
......@@ -2058,19 +2058,19 @@ yyreduce:
case 34:
#line 484 "cf-parse.y" /* yacc.c:1646 */
{ f_int(scanner, R_SYS, C_MAX_CONN_IDLE, (yyvsp[-1].tok).i); }
{ f_int(scanner, R_SYS, C_TCP_IDLE_TIMEOUT, (yyvsp[-1].tok).i); }
#line 2063 "cf-parse.tab.c" /* yacc.c:1646 */
break;
case 35:
#line 485 "cf-parse.y" /* yacc.c:1646 */
{ f_int(scanner, R_SYS, C_MAX_CONN_HANDSHAKE, (yyvsp[-1].tok).i); }
{ f_int(scanner, R_SYS, C_TCP_HSHAKE_TIMEOUT, (yyvsp[-1].tok).i); }
#line 2069 "cf-parse.tab.c" /* yacc.c:1646 */
break;
case 36:
#line 486 "cf-parse.y" /* yacc.c:1646 */
{ f_int(scanner, R_SYS, C_MAX_CONN_REPLY, (yyvsp[-1].tok).i); }
{ f_int(scanner, R_SYS, C_TCP_REPLY_TIMEOUT, (yyvsp[-1].tok).i); }
#line 2075 "cf-parse.tab.c" /* yacc.c:1646 */
break;
......
......@@ -481,9 +481,9 @@ system:
| system WORKERS NUM ';' { f_int(scanner, R_SYS, C_WORKERS, $3.i); }
| system BACKGROUND_WORKERS NUM ';' { f_int(scanner, R_SYS, C_BG_WORKERS, $3.i); }
| system ASYNC_START BOOL ';' { f_bool(scanner, R_SYS, C_ASYNC_START, $3.i); }
| system MAX_CONN_IDLE INTERVAL ';' { f_int(scanner, R_SYS, C_MAX_CONN_IDLE, $3.i); }
| system MAX_CONN_HS INTERVAL ';' { f_int(scanner, R_SYS, C_MAX_CONN_HANDSHAKE, $3.i); }
| system MAX_CONN_REPLY INTERVAL ';' { f_int(scanner, R_SYS, C_MAX_CONN_REPLY, $3.i); }
| system MAX_CONN_IDLE INTERVAL ';' { f_int(scanner, R_SYS, C_TCP_IDLE_TIMEOUT, $3.i); }
| system MAX_CONN_HS INTERVAL ';' { f_int(scanner, R_SYS, C_TCP_HSHAKE_TIMEOUT, $3.i); }
| system MAX_CONN_REPLY INTERVAL ';' { f_int(scanner, R_SYS, C_TCP_REPLY_TIMEOUT, $3.i); }
| system MAX_TCP_CLIENTS NUM ';' { f_int(scanner, R_SYS, C_MAX_TCP_CLIENTS, $3.i); }
| system RATE_LIMIT NUM ';' { f_int(scanner, R_SYS, C_RATE_LIMIT, $3.i); }
| system RATE_LIMIT_SIZE SIZE ';' { f_int(scanner, R_SYS, C_RATE_LIMIT_TBL_SIZE, $3.l); }
......
......@@ -72,9 +72,6 @@ typedef enum {
#define C_LISTEN "\x06""listen"
#define C_LOG "\x03""log"
#define C_MASTER "\x06""master"
#define C_MAX_CONN_HANDSHAKE "\x12""max-conn-handshake"
#define C_MAX_CONN_IDLE "\x0D""max-conn-idle"
#define C_MAX_CONN_REPLY "\x0E""max-conn-reply"
#define C_MAX_JOURNAL_SIZE "\x10""max-journal-size"
#define C_MAX_TCP_CLIENTS "\x0F""max-tcp-clients"
#define C_MAX_UDP_PAYLOAD "\x0F""max-udp-payload"
......@@ -94,6 +91,9 @@ typedef enum {
#define C_SRV "\x06""server"
#define C_STORAGE "\x07""storage"
#define C_TARGET "\x06""target"
#define C_TCP_HSHAKE_TIMEOUT "\x15""tcp-handshake-timeout"
#define C_TCP_IDLE_TIMEOUT "\x10""tcp-idle-timeout"
#define C_TCP_REPLY_TIMEOUT "\x11""tcp-reply-timeout"
#define C_TPL "\x08""template"
#define C_TRANSFERS "\x09""transfers"
#define C_USER "\x04""user"
......
......@@ -27,11 +27,11 @@ def create_servers(t):
for _ in range(3):
master = t.server("bind")
master.disable_notify = True
master.max_conn_idle = "1s"
master.tcp_idle_timeout = "1s"
slave = t.server("knot")
slave.disable_notify = True
slave.max_conn_idle = "1s"
slave.tcp_idle_timeout = "1s"
t.link(zone, master, slave)
......
......@@ -24,7 +24,7 @@ EXPIRE_SLEEP = 15
master = t.server("knot")
slave = t.server("knot")
slave.max_conn_idle = "1s"
slave.tcp_idle_timeout = "1s"
t.link(zone, master, slave)
......
......@@ -22,8 +22,8 @@ def set_slave(t, master, slave, zone):
def role_switch(t, master, slave, zone, action):
slave.zones = {}
master.zones = {}
slave.max_conn_idle = "1s"
master.max_conn_idle = "1s"
slave.tcp_idle_timeout = "1s"
master.tcp_idle_timeout = "1s"
action(t, master, slave, zone)
t.generate_conf()
......@@ -109,11 +109,11 @@ zone = t.zone("example.", storage=".")
master = t.server("knot")
master.disable_notify = True
master.max_conn_idle = "1s"
master.tcp_idle_timeout = "1s"
slave = t.server("knot")
slave.disable_notify = True
slave.max_conn_idle = "1s"
slave.tcp_idle_timeout = "1s"
t.link(zone, master, slave)
......
......@@ -91,7 +91,7 @@ class Server(object):
self.ratelimit = None
self.disable_any = None
self.disable_notify = None
self.max_conn_idle = None
self.tcp_idle_timeout = None
self.zonefile_sync = None
self.journal_size = None
......@@ -807,8 +807,8 @@ class Knot(Server):
self._on_str_hex(s, "nsid", self.nsid)
s.item_str("rundir", self.dir)
s.item_str("listen", "%s@%s" % (self.addr, self.port))
if (self.max_conn_idle):
s.item_str("max-conn-idle", self.max_conn_idle)
if (self.tcp_idle_timeout):
s.item_str("tcp-idle-timeout", self.tcp_idle_timeout)
if (self.ratelimit):
s.item_str("rate-limit", self.ratelimit)
s.end()
......@@ -915,8 +915,6 @@ class Knot(Server):
s.item_str("zonefile-sync", "1d")
if self.journal_size:
s.item_str("max-journal-size", self.journal_size)
s.item_str("notify-timeout", "5")
s.item_str("notify-retries", "5")
s.item_str("semantic-checks", "on")
if self.disable_any:
s.item_str("disable-any", "on")
......
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