Software /
code /
prosody
Changeset
5330:0a0ca2eb991b
net.server_select: Be less aggressive about server pause
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Feb 2013 03:24:30 +0100 |
parents | 5329:9fffd5fad4b3 |
children | 5331:ffa740b4f08d |
files | net/server_select.lua |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_select.lua Thu Feb 07 22:11:35 2013 +0100 +++ b/net/server_select.lua Tue Feb 12 03:24:30 2013 +0100 @@ -201,20 +201,23 @@ --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;