# HG changeset patch # User jbe # Date 1428704292 -7200 # Node ID 3bbcd75eefcd7d4080e2b88586bd3b9112eca31d # Parent 4997e742c81ccb2dd2969fd878ca4de01cc0ee66 Make moonbridge_io.poll(...) return immediately if there is data pending in read buffers diff -r 4997e742c81c -r 3bbcd75eefcd moonbridge_io.c --- a/moonbridge_io.c Sat Apr 11 00:10:45 2015 +0200 +++ b/moonbridge_io.c Sat Apr 11 00:18:12 2015 +0200 @@ -1000,7 +1000,10 @@ if (handle) { if (handle->closed) luaL_error(L, "Attempt to poll a closed connection"); fd = handle->fd; - if (fd < 0) { /* fake EOF to simulate shutdown */ + if ( + fd < 0 || /* fake EOF to simulate shutdown if fd < 0 */ + handle->readbufin != handle->readbufout /* data pending in buffer */ + ) { lua_pushboolean(L, 1); return 1; }