aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-28 14:33:27 +0100
committerKim Alvefur <zash@zash.se>2012-12-28 14:33:27 +0100
commitf2af5505314d8b8502fb1bc5b9549abfa7376b89 (patch)
tree85fb696aeb79c62987569f3f5616cf89bb6314cb /net
parent2021e2265fc358f59b155f36265b9fcb8b149c70 (diff)
downloadprosody-f2af5505314d8b8502fb1bc5b9549abfa7376b89.tar.gz
prosody-f2af5505314d8b8502fb1bc5b9549abfa7376b89.zip
net.server_select: Add pause and resume methods
Diffstat (limited to 'net')
-rw-r--r--net/server_select.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 8cb4e235..97c29b8c 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -197,6 +197,25 @@ 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()
+ if not handler.paused then
+ socket:close( )
+ _sendlistlen = removesocket( _sendlist, socket, _sendlistlen )
+ _readlistlen = removesocket( _readlist, socket, _readlistlen )
+ _socketlist[ socket ] = nil
+ socket = nil;
+ handler.paused = true;
+ end
+ end
+ handler.resume = function()
+ if handler.paused then
+ socket = socket_bind( ip, serverport );
+ socket:settimeout( 0 )
+ _readlistlen = addsocket(_readlist, socket, _readlistlen)
+ _socketlist[ socket ] = handler
+ handler.paused = false;
+ end
+ end
handler.ip = function( )
return ip
end