aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-02-12 03:24:30 +0100
committerKim Alvefur <zash@zash.se>2013-02-12 03:24:30 +0100
commit380d2bd865e058a85dd55071a6bc4a1f15618038 (patch)
treec204c38e60cfa9ba1d4d0e3416addbc1dde3dc89
parentbbb26de0d5b6cba99b42835e9720fe60272ca2d1 (diff)
downloadprosody-380d2bd865e058a85dd55071a6bc4a1f15618038.tar.gz
prosody-380d2bd865e058a85dd55071a6bc4a1f15618038.zip
net.server_select: Be less aggressive about server pause
-rw-r--r--net/server_select.lua19
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;