Browse code

core: option to check if server is in destroy modules phase

Daniel-Constantin Mierla authored on 01/03/2016 10:32:59
Showing 2 changed files
... ...
@@ -109,6 +109,17 @@ unsigned int set_modinit_delay(unsigned int v)
109 109
 	return r;
110 110
 }
111 111
 
112
+/* keep state if server is in destroy modules phase */
113
+static int _sr_destroy_modules_phase = 0;
114
+
115
+/**
116
+ * return destroy modules phase state
117
+ */
118
+int destroy_modules_phase(void)
119
+{
120
+	return _sr_destroy_modules_phase;
121
+}
122
+
112 123
 /**
113 124
  * if bit 1 set, SIP worker processes handle RPC commands as well
114 125
  * if bit 2 set, RPC worker processes handle SIP commands as well
... ...
@@ -791,6 +802,7 @@ void destroy_modules()
791 791
 {
792 792
 	struct sr_module* t, *foo;
793 793
 
794
+	_sr_destroy_modules_phase = 1;
794 795
 	/* call first destroy function from each module */
795 796
 	t=modules;
796 797
 	while(t) {
... ...
@@ -654,5 +654,6 @@ int is_sip_worker(int rank);
654 654
 int is_rpc_worker(int rank);
655 655
 
656 656
 unsigned int set_modinit_delay(unsigned int v);
657
+int destroy_modules_phase(void);
657 658
 
658 659
 #endif /* sr_module_h */