Software / code / prosody
Comparison
net/server_select.lua @ 5632:8a2456f1f117
net.server_select: Support for listener.onreadtimeout() [see also e67891ad18d6]
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 24 May 2013 18:14:09 +0100 |
| parent | 5548:c5d1c35c93f4 |
| child | 5633:d999027577ed |
comparison
equal
deleted
inserted
replaced
| 5631:78bc91f0d74b | 5632:8a2456f1f117 |
|---|---|
| 859 local difftime = os_difftime( _currenttime - _starttime ) | 859 local difftime = os_difftime( _currenttime - _starttime ) |
| 860 if difftime > _checkinterval then | 860 if difftime > _checkinterval then |
| 861 _starttime = _currenttime | 861 _starttime = _currenttime |
| 862 for handler, timestamp in pairs( _writetimes ) do | 862 for handler, timestamp in pairs( _writetimes ) do |
| 863 if os_difftime( _currenttime - timestamp ) > _sendtimeout then | 863 if os_difftime( _currenttime - timestamp ) > _sendtimeout then |
| 864 --_writetimes[ handler ] = nil | |
| 865 handler.disconnect( )( handler, "send timeout" ) | 864 handler.disconnect( )( handler, "send timeout" ) |
| 866 handler:force_close() -- forced disconnect | 865 handler:force_close() -- forced disconnect |
| 867 end | 866 end |
| 868 end | 867 end |
| 869 for handler, timestamp in pairs( _readtimes ) do | 868 for handler, timestamp in pairs( _readtimes ) do |
| 870 if os_difftime( _currenttime - timestamp ) > _readtimeout then | 869 if os_difftime( _currenttime - timestamp ) > _readtimeout then |
| 871 --_readtimes[ handler ] = nil | 870 if not(handler.onreadtimeout) or handler:onreadtimeout() ~= true then |
| 872 handler.disconnect( )( handler, "read timeout" ) | 871 handler.disconnect( )( handler, "read timeout" ) |
| 873 handler:close( ) -- forced disconnect? | 872 handler:close( ) -- forced disconnect? |
| 873 end | |
| 874 end | 874 end |
| 875 end | 875 end |
| 876 end | 876 end |
| 877 | 877 |
| 878 -- Fire timers | 878 -- Fire timers |