diff options
author | Kim Alvefur <zash@zash.se> | 2016-05-04 15:29:11 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-05-04 15:29:11 +0200 |
commit | b1ec0f7993d03701fd534ac40b806a9e07a60fc0 (patch) | |
tree | ff293fbfd347eb3a9344090af63e0f78ff07177c | |
parent | 8e0208a80558cb73757dfe83cb08fe8e1082f541 (diff) | |
download | prosody-b1ec0f7993d03701fd534ac40b806a9e07a60fc0.tar.gz prosody-b1ec0f7993d03701fd534ac40b806a9e07a60fc0.zip |
net.server_event: Schedule another read callback if there is still data left in buffer after reading (fixes #583 for real)
-rw-r--r-- | net/server_event.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/server_event.lua b/net/server_event.lua index e0dc175f..2cb45553 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -30,6 +30,7 @@ local cfg = { WRITE_TIMEOUT = 180, -- timeout in seconds for write data on socket CONNECT_TIMEOUT = 20, -- timeout in seconds for connection attempts CLEAR_DELAY = 5, -- seconds to wait for clearing interface list (and calling ondisconnect listeners) + READ_RETRY_DELAY = 1e-06, -- if, after reading, there is still data in buffer, wait this long and continue reading DEBUG = true, -- show debug messages } @@ -559,7 +560,7 @@ local function handleclient( client, ip, port, server, pattern, listener, sslctx interface.eventread = nil return -1 end - if EV_TIMEOUT == event and interface:onreadtimeout() ~= true then + if EV_TIMEOUT == event and not interface.conn:dirty() and interface:onreadtimeout() ~= true then return -1 -- took too long to get some data from client -> disconnect end if interface._usingssl then -- handle luasec @@ -605,6 +606,9 @@ local function handleclient( client, ip, port, server, pattern, listener, sslctx interface.eventread = nil; return -1; end + if interface.conn:dirty() then -- still data left in buffer + return EV_TIMEOUT, cfg.READ_RETRY_DELAY; + end return EV_READ, cfg.READ_TIMEOUT end |