Software /
code /
prosody
Comparison
plugins/mod_c2s.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 | 12480:7e9ebdc75ce4 |
comparison
equal
deleted
inserted
replaced
12310:91af1697ddd8 | 12311:bc30e1b9ad89 |
---|---|
431 pm.unregister_service(netservice.name, netservice); | 431 pm.unregister_service(netservice.name, netservice); |
432 end | 432 end |
433 end, -80); | 433 end, -80); |
434 | 434 |
435 module:hook("server-stopping", function(event) | 435 module:hook("server-stopping", function(event) |
436 local wait, done = async.waiter(); | 436 local wait, done = async.waiter(1, true); |
437 module:hook("c2s-closed", function () | 437 module:hook("c2s-closed", function () |
438 if next(sessions) == nil then done(); end | 438 if next(sessions) == nil then done(); end |
439 end) | 439 end) |
440 | 440 |
441 -- Close sessions | 441 -- Close sessions |