Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connect: stop halving the remaining timeout when less than N ms left
When curl wants to connect to a host, it always has a TIMEOUT. The maximum time it is allowed to spend until a connect is confirmed. curl will try to connect to each of the IP adresses returned for the host. Two loops, one for each IP family. During the connect loop, while curl has more than one IP address left to try within a single address family, curl has traditionally allowed (TIME-LEFT/2) for *this* connect attempt. This, to not get stuck on the initial addresses in case the timeout but still allow later addresses to get attempted. This has the downside that when users set a very short timeout and the host has a large number of IP addresses, the effective result might be that every attempt gets a little too short time. This change proposes that we stop doing the divided-by-two if the total time left is below a threshold. This threshold is 600 milliseconds in this initial commit. To discuss: A) a good/bad idea? B) what's the threshold? C) is there instead a better fix to do?
- Loading branch information