aboutsummaryrefslogtreecommitdiff
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
commit669ade6aab28df4dd1a567c101612b2c7ed02f6c (patch)
tree653705f6e7683de709f9c18ebba632cc051eca89 /net
parent10e98117e75c51305672719880cbc7862ad5b287 (diff)
downloadprosody-im-server-669ade6aab28df4dd1a567c101612b2c7ed02f6c.tar
prosody-im-server-669ade6aab28df4dd1a567c101612b2c7ed02f6c.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;