瀏覽代碼

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

Daniel-Constantin Mierla 9 年之前
父節點
當前提交
87027c654d
共有 2 個文件被更改,包括 13 次插入0 次删除
  1. 12 0
      sr_module.c
  2. 1 0
      sr_module.h

+ 12 - 0
sr_module.c

@@ -109,6 +109,17 @@ unsigned int set_modinit_delay(unsigned int v)
 	return r;
 }
 
+/* keep state if server is in destroy modules phase */
+static int _sr_destroy_modules_phase = 0;
+
+/**
+ * return destroy modules phase state
+ */
+int destroy_modules_phase(void)
+{
+	return _sr_destroy_modules_phase;
+}
+
 /**
  * if bit 1 set, SIP worker processes handle RPC commands as well
  * if bit 2 set, RPC worker processes handle SIP commands as well
@@ -791,6 +802,7 @@ void destroy_modules()
 {
 	struct sr_module* t, *foo;
 
+	_sr_destroy_modules_phase = 1;
 	/* call first destroy function from each module */
 	t=modules;
 	while(t) {

+ 1 - 0
sr_module.h

@@ -654,5 +654,6 @@ int is_sip_worker(int rank);
 int is_rpc_worker(int rank);
 
 unsigned int set_modinit_delay(unsigned int v);
+int destroy_modules_phase(void);
 
 #endif /* sr_module_h */