Use poll by default for socket.connect(), instead of select().

Connect timeouts are implemented by waiting on the new socket
descriptor. When select() is used for this, it imposes an arbitrary
limit on the number of connections that can be made, usually 1024-3.
Using poll() removes this limit on the number of simultaneous TCP
connections can be made using luasocket. The previous default
implementation using select() is available by defining SOCKET_SELECT.
Note that using socket.select() always uses select(), so it isn't
possible to wait on an arbitrary number of connections at once.
This commit is contained in:
Sam Roberts 2011-06-27 17:04:32 -07:00
parent 21698c7665
commit f63d616bc0

View File

@ -16,7 +16,7 @@
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\
* Wait for readable/writable/connected socket with timeout * Wait for readable/writable/connected socket with timeout
\*-------------------------------------------------------------------------*/ \*-------------------------------------------------------------------------*/
#ifdef SOCKET_POLL #ifndef SOCKET_SELECT
#include <sys/poll.h> #include <sys/poll.h>
#define WAITFD_R POLLIN #define WAITFD_R POLLIN