aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
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
commitb093d6f947836d3c4d5981a4d430a8e6c9717a53 (patch)
tree4d12663c5e4201825d215887235cba5aeb3a37ef /net/server_epoll.lua
parent1aa0b3a4baeadbf016e8da7c494d2c2233c754f1 (diff)
downloadprosody-b093d6f947836d3c4d5981a4d430a8e6c9717a53.tar.gz
prosody-b093d6f947836d3c4d5981a4d430a8e6c9717a53.zip
server_epoll: Add closeall() method for closing all clients and servers
Diffstat (limited to 'net/server_epoll.lua')
-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;