|
@@ -120,6 +120,17 @@ struct sr_module* modules=0;
|
|
|
int mod_response_cbk_no=0;
|
|
|
response_function* mod_response_cbks=0;
|
|
|
|
|
|
+/* number of usec to wait before initializing a module */
|
|
|
+static unsigned int modinit_delay = 0;
|
|
|
+
|
|
|
+unsigned int set_modinit_delay(unsigned int v)
|
|
|
+{
|
|
|
+ unsigned int r;
|
|
|
+ r = modinit_delay;
|
|
|
+ modinit_delay = v;
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* if bit 1 set, SIP worker processes handle RPC commands as well
|
|
|
* if bit 2 set, RPC worker processes handle SIP commands as well
|
|
@@ -832,12 +843,16 @@ int init_modules(void)
|
|
|
struct sr_module* t;
|
|
|
|
|
|
for(t = modules; t; t = t->next) {
|
|
|
- if (t->exports.init_f)
|
|
|
+ if (t->exports.init_f) {
|
|
|
if (t->exports.init_f() != 0) {
|
|
|
LOG(L_ERR, "init_modules(): Error while"
|
|
|
" initializing module %s\n", t->exports.name);
|
|
|
return -1;
|
|
|
}
|
|
|
+ /* delay next module init, if configured */
|
|
|
+ if(unlikely(modinit_delay>0))
|
|
|
+ sleep_us(modinit_delay);
|
|
|
+ }
|
|
|
if (t->exports.response_f)
|
|
|
mod_response_cbk_no++;
|
|
|
}
|