moonbridge

changeset 122:3bbcd75eefcd

Make moonbridge_io.poll(...) return immediately if there is data pending in read buffers
author jbe
date Sat Apr 11 00:18:12 2015 +0200 (2015-04-11)
parents 4997e742c81c
children 20e0d4f51381
files moonbridge_io.c
line diff
     1.1 --- a/moonbridge_io.c	Sat Apr 11 00:10:45 2015 +0200
     1.2 +++ b/moonbridge_io.c	Sat Apr 11 00:18:12 2015 +0200
     1.3 @@ -1000,7 +1000,10 @@
     1.4          if (handle) {
     1.5            if (handle->closed) luaL_error(L, "Attempt to poll a closed connection");
     1.6            fd = handle->fd;
     1.7 -          if (fd < 0) {  /* fake EOF to simulate shutdown */
     1.8 +          if (
     1.9 +            fd < 0 ||  /* fake EOF to simulate shutdown if fd < 0 */
    1.10 +            handle->readbufin != handle->readbufout  /* data pending in buffer */
    1.11 +          ) {
    1.12              lua_pushboolean(L, 1);
    1.13              return 1;
    1.14            }

Impressum / About Us