Changeset

12311:bc30e1b9ad89

mod_c2s,mod_s2s: Fix error on shutdown (Thanks Martin) Since there are two calls to done() that can happen, if the timing is right (or wrong) both can happen, which previously triggered an error.
author Kim Alvefur <zash@zash.se>
date Tue, 22 Feb 2022 14:17:27 +0100 (2022-02-22)
parents 12310:91af1697ddd8
children 12312:8119a58b3a5c
files plugins/mod_c2s.lua plugins/mod_s2s.lua
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Tue Feb 22 14:17:10 2022 +0100
+++ b/plugins/mod_c2s.lua	Tue Feb 22 14:17:27 2022 +0100
@@ -433,7 +433,7 @@
 end, -80);
 
 module:hook("server-stopping", function(event)
-	local wait, done = async.waiter();
+	local wait, done = async.waiter(1, true);
 	module:hook("c2s-closed", function ()
 		if next(sessions) == nil then done(); end
 	end)
--- a/plugins/mod_s2s.lua	Tue Feb 22 14:17:10 2022 +0100
+++ b/plugins/mod_s2s.lua	Tue Feb 22 14:17:27 2022 +0100
@@ -973,7 +973,7 @@
 		end
 	end
 
-	local wait, done = async.waiter();
+	local wait, done = async.waiter(1, true);
 	module:hook("s2s-closed", function ()
 		if next(sessions) == nil then done(); end
 	end, 1)