diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-05-24 18:14:09 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-05-24 18:14:09 +0100 |
commit | 8e377ca47c1ffd514390988f782f41faa127b31a (patch) | |
tree | 406f43fbeee67a4802fa3adb34cb75d175fe7233 /net/server_select.lua | |
parent | bc17d8f64fae69b01a5b27509dffaba8748ce945 (diff) | |
download | prosody-8e377ca47c1ffd514390988f782f41faa127b31a.tar.gz prosody-8e377ca47c1ffd514390988f782f41faa127b31a.zip |
net.server_select: Support for listener.onreadtimeout() [see also e67891ad18d6]
Diffstat (limited to 'net/server_select.lua')
-rw-r--r-- | net/server_select.lua | 8 |
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 |