mod_scansion_record: Close files in the cleanup stage of shutdown (fixes use after close)
authorKim Alvefur <zash@zash.se>
Sat, 22 Sep 2018 15:14:25 +0200
changeset 9369 9472b4044fc6
parent 9368 acb316319dc0
child 9370 577c3a7f5045
mod_scansion_record: Close files in the cleanup stage of shutdown (fixes use after close)
plugins/mod_scansion_record.lua
--- a/plugins/mod_scansion_record.lua	Sat Sep 22 14:38:40 2018 +0200
+++ b/plugins/mod_scansion_record.lua	Sat Sep 22 15:14:25 2018 +0200
@@ -88,6 +88,9 @@
 module:hook_global("server-stopping", function ()
 	record("# recording ended on "..dt.datetime().."\n");
 	module:log("info", "Scansion recording available in %s", record_file);
+end);
+
+prosody.events.add_handler("server-cleanup", function ()
 	scan:close();
 	head:close()
 end);