aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-01-01 19:30:38 +0100
committerKim Alvefur <zash@zash.se>2017-01-01 19:30:38 +0100
commit4c52149e6535190ad71f130ad8243afabd4acfcd (patch)
tree4d12663c5e4201825d215887235cba5aeb3a37ef /net
parent0b94607fcc49a9abd09515966e0218e2393b2ec3 (diff)
downloadprosody-4c52149e6535190ad71f130ad8243afabd4acfcd.tar.gz
prosody-4c52149e6535190ad71f130ad8243afabd4acfcd.zip
server_epoll: Add closeall() method for closing all clients and servers
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 117fa1dc..23564816 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -15,6 +15,7 @@ local t_concat = table.concat;
local setmetatable = setmetatable;
local tostring = tostring;
local pcall = pcall;
+local pairs = pairs;
local log = require "util.logger".init("server_epoll");
local epoll = require "epoll";
local socket = require "socket";
@@ -602,6 +603,12 @@ function interface:set_send(new_send)
self.send = new_send;
end
+local function closeall()
+ for fd, conn in pairs(fds) do
+ conn:close();
+ end
+end
+
local quitting = nil;
-- Signal main loop about shutdown via above upvalue
@@ -641,6 +648,7 @@ return {
add_task = addtimer;
at = at;
loop = loop;
+ closeall = closeall;
setquitting = setquitting;
wrapclient = wrapclient;
link = link;