Software /
code /
prosody
Changeset
7794:424bbbeb9257
server_epoll: Add closeall() method for closing all clients and servers
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 01 Jan 2017 19:30:38 +0100 |
parents | 7791:8efd51667622 |
children | 7795:03081bd5c5bb |
files | net/server_epoll.lua |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_epoll.lua Mon Dec 19 09:34:40 2016 +0100 +++ b/net/server_epoll.lua Sun Jan 01 19:30:38 2017 +0100 @@ -15,6 +15,7 @@ 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 @@ 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 @@ add_task = addtimer; at = at; loop = loop; + closeall = closeall; setquitting = setquitting; wrapclient = wrapclient; link = link;