curl / Mailing Lists / curl-library / Single Mail


Limit connection reuse to the first 120 seconds

From: Daniel Stenberg via curl-library <>
Date: Mon, 15 Apr 2019 22:37:47 +0200 (CEST)


I propose we change the connection reuse logic in curl to only ever consider
connections that have been kept in the connection pool for shorter than 120
seconds. Connections that have been kept around for longer than this will
instead get disconnected [1].

The reason is simply that the longer the connection has been idle, the less
likely it is to a) be useful again and b) to actually work to reuse. Avoiding
reuse attempts that have a high risk of failing will improve performance and

My PR for this change is here[2]. The max age (120 seconds) in this code is
currently "hardcoded" but I'm sure there might be use cases for changing it,
so I'm open for making it possible to set through the API.


[1] = they will get disconnected when "found" by one of the algorithms so they
may in fact be kept around longer than 120 seconds but they will not be reused
if found later.

[2] =

Received on 2019-04-15