aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-01-01 19:34:18 +0100
committerKim Alvefur <zash@zash.se>2017-01-01 19:34:18 +0100
commit261689750a9c2f2a20c4f9a588452e0a941115e3 (patch)
tree090e4edaf9b1c0b3c7da45d22fb30f8e3efc7182 /net
parent6852097e71e645c5fc46a4316399e2444daebbac (diff)
downloadprosody-im-server-261689750a9c2f2a20c4f9a588452e0a941115e3.tar
prosody-im-server-261689750a9c2f2a20c4f9a588452e0a941115e3.zip
server_epoll: Flush and close all connections before quitting mainloop so no data is lost in buffers
Diffstat (limited to 'net')
-rw-r--r--net/server_epoll.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index d5f9d266..274368b0 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 next = next;
local pairs = pairs;
local log = require "util.logger".init("server_epoll");
local epoll = require "epoll";
@@ -615,6 +616,7 @@ local quitting = nil;
local function setquitting(quit)
if quit then
quitting = "quitting";
+ closeall();
else
quitting = nil;
end
@@ -641,7 +643,7 @@ local function loop(once)
elseif r ~= "timeout" then
log("debug", "epoll_wait error: %s", tostring(r));
end
- until once or quitting;
+ until once or (quitting and next(fds) == nil);
return quitting;
end