diff options
author | Kim Alvefur <zash@zash.se> | 2013-02-12 03:24:30 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-02-12 03:24:30 +0100 |
commit | 4f6cb9d1c644fdd8d7254e4ae38e7dc96f971ba3 (patch) | |
tree | c204c38e60cfa9ba1d4d0e3416addbc1dde3dc89 /net | |
parent | 62d876cf007b26c6167c3b9693f247e62a5dabf3 (diff) | |
download | prosody-4f6cb9d1c644fdd8d7254e4ae38e7dc96f971ba3.tar.gz prosody-4f6cb9d1c644fdd8d7254e4ae38e7dc96f971ba3.zip |
net.server_select: Be less aggressive about server pause
Diffstat (limited to 'net')
-rw-r--r-- | net/server_select.lua | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/net/server_select.lua b/net/server_select.lua index 0852d444..36cb1265 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -201,20 +201,23 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx, maxco --mem_free( ) out_put "server.lua: closed server handler and removed sockets from list" end - handler.pause = function() + handler.pause = function( hard ) if not handler.paused then - socket:close( ) - _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) _readlistlen = removesocket( _readlist, socket, _readlistlen ) - _socketlist[ socket ] = nil - socket = nil; + if hard then + _socketlist[ socket ] = nil + socket:close( ) + socket = nil; + end handler.paused = true; end end - handler.resume = function() + handler.resume = function( ) if handler.paused then - socket = socket_bind( ip, serverport ); - socket:settimeout( 0 ) + if not socket then + socket = socket_bind( ip, serverport ); + socket:settimeout( 0 ) + end _readlistlen = addsocket(_readlist, socket, _readlistlen) _socketlist[ socket ] = handler handler.paused = false; |