Software /
code /
prosody
Comparison
net/server.lua @ 2766:5fe6ea49cf70
net.server_select: Restore checks for wantread/timeout errors on receive
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 03 Dec 2009 19:18:18 +0000 |
parent | 2765:3cb9df793269 |
child | 2923:b7049746bd29 |
comparison
equal
deleted
inserted
replaced
2765:3cb9df793269 | 2766:5fe6ea49cf70 |
---|---|
465 end | 465 end |
466 return noread, nosend | 466 return noread, nosend |
467 end | 467 end |
468 local _readbuffer = function( ) -- this function reads data | 468 local _readbuffer = function( ) -- this function reads data |
469 local buffer, err, part = receive( socket, pattern ) -- receive buffer with "pattern" | 469 local buffer, err, part = receive( socket, pattern ) -- receive buffer with "pattern" |
470 if not err or string_len(part) > 0 then -- received something | 470 if not err or (err == "wantread" or err == "timeout") or string_len(part) > 0 then -- received something |
471 local buffer = buffer or part or "" | 471 local buffer = buffer or part or "" |
472 local len = string_len( buffer ) | 472 local len = string_len( buffer ) |
473 if len > maxreadlen then | 473 if len > maxreadlen then |
474 disconnect( handler, "receive buffer exceeded" ) | 474 disconnect( handler, "receive buffer exceeded" ) |
475 handler.close( true ) | 475 handler.close( true ) |