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