Just re-read RFC7858 and realised that TLS does support idle connections without keepalive. It is just TCP that doesn't.

This commit is contained in:
Sara Dickinson 2016-07-02 16:43:47 +01:00
parent 5e1575dabc
commit 105d7acfa9
1 changed files with 10 additions and 7 deletions

View File

@ -326,14 +326,17 @@ process_keepalive(
int found = match_edns_opt_rr(GLDNS_EDNS_KEEPALIVE, response,
response_len, &position, &option_len);
if (found != 2 || option_len != 2) {
if (netreq->keepalive_sent == 1)
/* If no keepalive sent back, then we must use 0 idle timeout
as server does not support it.*/
#if defined(KEEP_CONNECTIONS_OPEN_DEBUG) && KEEP_CONNECTIONS_OPEN_DEBUG
upstream->keepalive_timeout = netreq->owner->context->idle_timeout;
#else
if (netreq->keepalive_sent == 1) {
/* For TCP if no keepalive sent back, then we must use 0 idle timeout
as server does not support it. TLS allows idle connections without
keepalive, according to RFC7858. */
#if !defined(KEEP_CONNECTIONS_OPEN_DEBUG) && !KEEP_CONNECTIONS_OPEN_DEBUG
if (upstream->transport != GETDNS_TRANSPORT_TLS)
upstream->keepalive_timeout = 0;
else
#endif
upstream->keepalive_timeout = netreq->owner->context->idle_timeout;
}
return;
}
/* Use server sent value unless the client specified a shorter one.