Faster timeout when connecting

Use non-blocking connects, and a select() call to wait a predefined
time (5s by default, but configurable with -timeout) for either
success or failure. This allows much more connections to be tried
per time unit.

Based on a patch by phantomcircuit.
This commit is contained in:
Pieter Wuille
2011-06-06 20:35:01 +02:00
parent e051f1b510
commit 76d660ebd3
5 changed files with 93 additions and 3 deletions

View File

@@ -105,6 +105,8 @@ T* alignup(T* p)
typedef int socklen_t;
#else
#define WSAGetLastError() errno
#define WSAEINVAL EINVAL
#define WSAEALREADY EALREADY
#define WSAEWOULDBLOCK EWOULDBLOCK
#define WSAEMSGSIZE EMSGSIZE
#define WSAEINTR EINTR