Software /
code /
prosody
Changeset
7797:d0c32d86724f
server_epoll: Flush and close all connections before quitting mainloop so no data is lost in buffers
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 01 Jan 2017 19:34:18 +0100 |
parents | 7796:12609aee3b3b |
children | 7798:74cfec1fe5a2 |
files | net/server_epoll.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_epoll.lua Sun Jan 01 19:33:38 2017 +0100 +++ b/net/server_epoll.lua Sun Jan 01 19:34:18 2017 +0100 @@ -15,6 +15,7 @@ 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 function setquitting(quit) if quit then quitting = "quitting"; + closeall(); else quitting = nil; end @@ -641,7 +643,7 @@ 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