From 900cd200a222abb89c8636f4f982d6d1759aecf1 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 31 Jul 2018 08:00:57 +0000 Subject: [PATCH] more comments (from commit messages). git-svn-id: file:///svn/unbound/trunk@4812 be551aaa-1e26-0410-a405-d3ace91eadb9 --- util/edns.c | 5 +++++ util/netevent.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/util/edns.c b/util/edns.c index deddd0f9b..b2c25b602 100644 --- a/util/edns.c +++ b/util/edns.c @@ -53,6 +53,11 @@ static int edns_keepalive(struct edns_data* edns_out, struct edns_data* edns_in, if(c->type == comm_udp) return 1; + /* To respond with a Keepalive option, the client connection + * must have received one message with a TCP Keepalive EDNS option, + * and that option must have 0 length data. Subsequent messages + * sent on that connection will have a TCP Keepalive option. + */ if(c->tcp_keepalive || edns_opt_list_find(edns_in->opt_list, LDNS_EDNS_KEEPALIVE)) { int keepalive = c->tcp_timeout_msec / 100; diff --git a/util/netevent.c b/util/netevent.c index fac3b8c4f..641ee7559 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -743,6 +743,15 @@ setup_tcp_handler(struct comm_point* c, int fd, int cur, int max) /* if more than half the tcp handlers are in use, use a shorter * timeout for this TCP connection, we need to make space for * other connections to be able to get attention */ + /* If > 50% TCP handler structures in use, set timeout to 1/100th + * configured value. + * If > 65%TCP handler structures in use, set to 1/500th configured + * value. + * If > 80% TCP handler structures in use, set to 0. + * + * If the timeout to use falls below 200 milliseconds, an actual + * timeout of 200ms is used. + */ handler_usage = (cur * 100) / max; if(handler_usage > 50 && handler_usage <= 65) c->tcp_timeout_msec /= 100; -- 2.47.3