aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-05-04 16:58:25 +0200
committerKim Alvefur <zash@zash.se>2016-05-04 16:58:25 +0200
commit4c1aa4d4ee89dcd4738c73a29e7c13774428b9ba (patch)
tree4069efefa5eba71585ead8faa0cbe970de5dcecd
parentea6f8f4f6ac68d671fa09ec177617e781e4a915f (diff)
parentb919112a2e1e1ce92a6abb073ec56cda2b6afb8e (diff)
downloadprosody-4c1aa4d4ee89dcd4738c73a29e7c13774428b9ba.tar.gz
prosody-4c1aa4d4ee89dcd4738c73a29e7c13774428b9ba.zip
Merge 0.10->trunk
-rw-r--r--core/portmanager.lua2
-rw-r--r--net/server_event.lua11
2 files changed, 7 insertions, 6 deletions
diff --git a/core/portmanager.lua b/core/portmanager.lua
index 60f7731d..ad1a0be3 100644
--- a/core/portmanager.lua
+++ b/core/portmanager.lua
@@ -29,7 +29,7 @@ if socket.tcp6 and config.get("*", "use_ipv6") ~= false then
table.insert(default_local_interfaces, "::1");
end
-local default_mode = config.get("*", "network_default_read_size") or "*a";
+local default_mode = config.get("*", "network_default_read_size") or 4096;
--- Private state
diff --git a/net/server_event.lua b/net/server_event.lua
index 08524646..c10173e4 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
@@ -588,10 +589,7 @@ local function handleclient( client, ip, port, server, pattern, listener, sslctx
interface.eventwrite = addevent( base, interface.conn, EV_WRITE, interface.writecallback, cfg.WRITE_TIMEOUT )
end
interface.eventreadtimeout = addevent( base, nil, EV_TIMEOUT,
- function( )
- interface:_close()
- end, cfg.READ_TIMEOUT
- )
+ function( ) interface:_close() end, cfg.READ_TIMEOUT)
debug( "wantwrite during read attempt, reg it in writecallback but dont know what really happens next..." )
-- to be honest i dont know what happens next, if it is allowed to first read, the write etc...
else -- connection was closed or fatal error
@@ -608,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