# HG changeset patch # User Kim Alvefur # Date 1360635870 -3600 # Node ID 0a0ca2eb991beb3893bca52403b41266b65c86ae # Parent 9fffd5fad4b3974e0a9d0d77f2986af735d4010a net.server_select: Be less aggressive about server pause diff -r 9fffd5fad4b3 -r 0a0ca2eb991b net/server_select.lua --- 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;