From 87027c654d9381f79c305b18f33919b8c9a86b89 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Tue, 1 Mar 2016 11:32:59 +0100 Subject: [PATCH] core: option to check if server is in destroy modules phase --- sr_module.c | 12 ++++++++++++ sr_module.h | 1 + 2 files changed, 13 insertions(+) diff --git a/sr_module.c b/sr_module.c index 6ddbd00637c..24a3ea3d23a 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 @@ -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) { diff --git a/sr_module.h b/sr_module.h index b20cd63ad65..6eb42fb6227 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 */