prosody: Fire events during server shutdown process

Tue, 21 Apr 2009 22:05:21 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 21 Apr 2009 22:05:21 +0100
changeset 1026
e640df2e4e9b
parent 1024
1bcc8ca57a7c
child 1027
fe2e3d3dba6a

prosody: Fire events during server shutdown process

prosody file | annotate | diff | comparison | revisions
--- a/prosody	Tue Apr 21 21:10:42 2009 +0100
+++ b/prosody	Tue Apr 21 22:05:21 2009 +0100
@@ -160,6 +160,7 @@
 -- Global function to initiate prosody shutdown
 function prosody_shutdown(reason)
 	log("info", "Shutting down: %s", reason or "unknown reason");
+	eventmanager.fire_event("server-stopping", { reason = reason });
 	server.setquitting(true);
 end
 
@@ -198,6 +199,8 @@
 	socket.sleep(0.2);
 end
 
+eventmanager.fire_event("server-cleanup");
+
 -- Ok, we're quitting I know, but we
 -- need to do some tidying before we go :)
 server.setquitting(false);
@@ -224,3 +227,5 @@
 end
 
 server.closeall();
+
+eventmanager.fire_event("server-stopped");

mercurial