aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-24 18:14:09 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-24 18:14:09 +0100
commitb5eff9a9018c37698bbb850452a5c8bf504051a4 (patch)
tree406f43fbeee67a4802fa3adb34cb75d175fe7233 /net/server_select.lua
parent3050ac293682e300f7ed14deb1a0d6dca5ae3307 (diff)
downloadprosody-b5eff9a9018c37698bbb850452a5c8bf504051a4.tar.gz
prosody-b5eff9a9018c37698bbb850452a5c8bf504051a4.zip
net.server_select: Support for listener.onreadtimeout() [see also e67891ad18d6]
Diffstat (limited to 'net/server_select.lua')
-rw-r--r--net/server_select.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 7eb330a8..0e7f41f8 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -861,16 +861,16 @@ loop = function(once) -- this is the main loop of the program
_starttime = _currenttime
for handler, timestamp in pairs( _writetimes ) do
if os_difftime( _currenttime - timestamp ) > _sendtimeout then
- --_writetimes[ handler ] = nil
handler.disconnect( )( handler, "send timeout" )
handler:force_close() -- forced disconnect
end
end
for handler, timestamp in pairs( _readtimes ) do
if os_difftime( _currenttime - timestamp ) > _readtimeout then
- --_readtimes[ handler ] = nil
- handler.disconnect( )( handler, "read timeout" )
- handler:close( ) -- forced disconnect?
+ if not(handler.onreadtimeout) or handler:onreadtimeout() ~= true then
+ handler.disconnect( )( handler, "read timeout" )
+ handler:close( ) -- forced disconnect?
+ end
end
end
end