diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2011-06-27 17:04:32 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2012-04-11 13:45:59 -0700 |
commit | f63d616bc048fe256181ff5e7e4aaca11afe3237 (patch) | |
tree | b1869e91954804a25f676adb2389059c9043a466 | |
parent | 21698c7665ee1cb43e1b83c3ea5cf4dbf827c1df (diff) | |
download | luasocket-f63d616bc048fe256181ff5e7e4aaca11afe3237.tar.gz luasocket-f63d616bc048fe256181ff5e7e4aaca11afe3237.tar.bz2 luasocket-f63d616bc048fe256181ff5e7e4aaca11afe3237.zip |
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.
-rw-r--r-- | src/usocket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/usocket.c b/src/usocket.c index 97f8b4f..e43cfa4 100644 --- a/src/usocket.c +++ b/src/usocket.c | |||
@@ -16,7 +16,7 @@ | |||
16 | /*-------------------------------------------------------------------------*\ | 16 | /*-------------------------------------------------------------------------*\ |
17 | * Wait for readable/writable/connected socket with timeout | 17 | * Wait for readable/writable/connected socket with timeout |
18 | \*-------------------------------------------------------------------------*/ | 18 | \*-------------------------------------------------------------------------*/ |
19 | #ifdef SOCKET_POLL | 19 | #ifndef SOCKET_SELECT |
20 | #include <sys/poll.h> | 20 | #include <sys/poll.h> |
21 | 21 | ||
22 | #define WAITFD_R POLLIN | 22 | #define WAITFD_R POLLIN |