Comparison

plugins/mod_s2s.lua @ 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
parent 12309:926a6c5d13e7
child 12362:0fd58f54d653
comparison
equal deleted inserted replaced
12310:91af1697ddd8 12311:bc30e1b9ad89
971 if prosody.hosts[host].modules.s2s then 971 if prosody.hosts[host].modules.s2s then
972 module:context(host):unhook("route/remote", route_to_new_session); 972 module:context(host):unhook("route/remote", route_to_new_session);
973 end 973 end
974 end 974 end
975 975
976 local wait, done = async.waiter(); 976 local wait, done = async.waiter(1, true);
977 module:hook("s2s-closed", function () 977 module:hook("s2s-closed", function ()
978 if next(sessions) == nil then done(); end 978 if next(sessions) == nil then done(); end
979 end, 1) 979 end, 1)
980 980
981 -- Close sessions 981 -- Close sessions