# HG changeset patch # User Kim Alvefur # Date 1483295438 -3600 # Node ID 424bbbeb92571ce1bb778b170de5b6af40b3f0c7 # Parent 8efd51667622cca48072580a885362eab3404182 server_epoll: Add closeall() method for closing all clients and servers diff -r 8efd51667622 -r 424bbbeb9257 net/server_epoll.lua --- 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;