aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luasocket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/luasocket.c b/src/luasocket.c
index 5168fbd..636bec2 100644
--- a/src/luasocket.c
+++ b/src/luasocket.c
@@ -576,7 +576,7 @@ int global_select(lua_State *L)
576 int ms = lua_isnil(L, 3) ? -1 : (int) (luaL_opt_number(L, 3, -1) * 1000); 576 int ms = lua_isnil(L, 3) ? -1 : (int) (luaL_opt_number(L, 3, -1) * 1000);
577 fd_set readfds, *prfds = NULL, writefds, *pwfds = NULL; 577 fd_set readfds, *prfds = NULL, writefds, *pwfds = NULL;
578 struct timeval tm, *ptm = NULL; 578 struct timeval tm, *ptm = NULL;
579 int ret; 579 int ret, dirty = 0;
580 unsigned max = 0; 580 unsigned max = 0;
581 SOCKET s; 581 SOCKET s;
582 int byfds, canread, canwrite; 582 int byfds, canread, canwrite;
@@ -604,7 +604,7 @@ int global_select(lua_State *L)
604 out which of the other sockets can be written to 604 out which of the other sockets can be written to
605 or read from immediately. */ 605 or read from immediately. */
606 if (!bf_isempty(sock)) { 606 if (!bf_isempty(sock)) {
607 ms = 0; 607 ms = 0; dirty = 1;
608 lua_pushnumber(L, lua_getn(L, canread) + 1); 608 lua_pushnumber(L, lua_getn(L, canread) + 1);
609 lua_pushvalue(L, -2); 609 lua_pushvalue(L, -2);
610 lua_settable(L, canread); 610 lua_settable(L, canread);
@@ -648,7 +648,7 @@ int global_select(lua_State *L)
648 /* see if we can read, write or if we timedout */ 648 /* see if we can read, write or if we timedout */
649 ret = select(max, prfds, pwfds, NULL, ptm); 649 ret = select(max, prfds, pwfds, NULL, ptm);
650 /* did we timeout? */ 650 /* did we timeout? */
651 if (ret <= 0 && ms >= 0) { 651 if (ret <= 0 && ms >= 0 && !dirty) {
652 push_error(L, NET_TIMEOUT); 652 push_error(L, NET_TIMEOUT);
653 return 3; 653 return 3;
654 } 654 }