Software /
code /
prosody
Diff
net/server_select.lua @ 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 |
parent | 2250:3196dabe8a36 |
child | 2304:26f59e5e5c03 |
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