Software /
code /
prosody
Comparison
net/server_epoll.lua @ 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 |
parent | 7737:f93b3083b46b |
child | 7795:03081bd5c5bb |
comparison
equal
deleted
inserted
replaced
7791:8efd51667622 | 7794:424bbbeb9257 |
---|---|
13 local t_remove = table.remove; | 13 local t_remove = table.remove; |
14 local t_concat = table.concat; | 14 local t_concat = table.concat; |
15 local setmetatable = setmetatable; | 15 local setmetatable = setmetatable; |
16 local tostring = tostring; | 16 local tostring = tostring; |
17 local pcall = pcall; | 17 local pcall = pcall; |
18 local pairs = pairs; | |
18 local log = require "util.logger".init("server_epoll"); | 19 local log = require "util.logger".init("server_epoll"); |
19 local epoll = require "epoll"; | 20 local epoll = require "epoll"; |
20 local socket = require "socket"; | 21 local socket = require "socket"; |
21 local luasec = require "ssl"; | 22 local luasec = require "ssl"; |
22 local gettime = require "util.time".now; | 23 local gettime = require "util.time".now; |
598 | 599 |
599 -- XXX What uses this? | 600 -- XXX What uses this? |
600 -- net.adns | 601 -- net.adns |
601 function interface:set_send(new_send) | 602 function interface:set_send(new_send) |
602 self.send = new_send; | 603 self.send = new_send; |
604 end | |
605 | |
606 local function closeall() | |
607 for fd, conn in pairs(fds) do | |
608 conn:close(); | |
609 end | |
603 end | 610 end |
604 | 611 |
605 local quitting = nil; | 612 local quitting = nil; |
606 | 613 |
607 -- Signal main loop about shutdown via above upvalue | 614 -- Signal main loop about shutdown via above upvalue |
639 addserver = addserver; | 646 addserver = addserver; |
640 addclient = addclient; | 647 addclient = addclient; |
641 add_task = addtimer; | 648 add_task = addtimer; |
642 at = at; | 649 at = at; |
643 loop = loop; | 650 loop = loop; |
651 closeall = closeall; | |
644 setquitting = setquitting; | 652 setquitting = setquitting; |
645 wrapclient = wrapclient; | 653 wrapclient = wrapclient; |
646 link = link; | 654 link = link; |
647 set_config = function (newconfig) | 655 set_config = function (newconfig) |
648 cfg = setmetatable(newconfig, default_config); | 656 cfg = setmetatable(newconfig, default_config); |