Module: kamailio
Branch: 4.3
Commit: 53d36500faa78270096a13b06466fdbc96a00760
URL:
https://github.com/kamailio/kamailio/commit/53d36500faa78270096a13b06466fdb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-03-02T13:00:59+01:00
core: option to check if server is in destroy modules phase
(cherry picked from commit 87027c654d9381f79c305b18f33919b8c9a86b89)
---
Modified: sr_module.c
Modified: sr_module.h
---
Diff:
https://github.com/kamailio/kamailio/commit/53d36500faa78270096a13b06466fdb…
Patch:
https://github.com/kamailio/kamailio/commit/53d36500faa78270096a13b06466fdb…
---
diff --git a/sr_module.c b/sr_module.c
index 057bf02..d2d22ca 100644
--- a/sr_module.c
+++ b/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
@@ -797,6 +808,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) {
diff --git a/sr_module.h b/sr_module.h
index b20cd63..6eb42fb 100644
--- a/sr_module.h
+++ b/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 */