Changeset

2302:2dc9bbf25447

net.server_select: Fix possibility of losing data sent from a socket just before it closes (thanks Sjoerd Simons)
author Matthew Wild <mwild1@gmail.com>
date Thu, 03 Dec 2009 02:28:34 +0000
parents 2301:8a01b0898679
children 2303:ecbd68fc46db
files net/server_select.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Thu Dec 03 01:13:06 2009 +0000
+++ b/net/server_select.lua	Thu Dec 03 02:28:34 2009 +0000
@@ -467,7 +467,7 @@
     end
     local _readbuffer = function( )    -- this function reads data
         local buffer, err, part = receive( socket, pattern )    -- receive buffer with "pattern"
-        if not err or ( err == "timeout" or err == "wantread" ) then    -- received something
+        if not err or string_len(part) > 0 then    -- received something
             local buffer = buffer or part or ""
             local len = string_len( buffer )
             if len > maxreadlen then