aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-30 18:14:52 +0000
committerautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-30 18:14:52 +0000
commit8b5532e2913b769894d49cc1494d9a4351b3a231 (patch)
treed42c21628d373a4a09d8aca6ebe3089fd697f53f /asterisk.c
parenta1a377ab86aafd40a919b91bf8bbc002d124eb5c (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@52949 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/asterisk.c b/asterisk.c
index d3b3989de..763f56a88 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -234,6 +234,8 @@ static int shuttingdown = 0;
static int restartnow = 0;
static pthread_t consolethread = AST_PTHREADT_NULL;
+static unsigned int need_reload;
+
#if !defined(LOW_MEMORY)
struct file_version {
AST_LIST_ENTRY(file_version) list;
@@ -747,8 +749,7 @@ static void hup_handler(int num)
printf("Received HUP signal -- Reloading configs\n");
if (restartnow)
execvp(_argv[0], _argv);
- /* XXX This could deadlock XXX */
- ast_module_reload(NULL);
+ need_reload = 1;
signal(num, hup_handler);
}
@@ -1816,6 +1817,11 @@ static void ast_remotecontrol(char * data)
}
}
}
+
+ if (need_reload) {
+ need_reload = 0;
+ ast_module_reload(NULL);
+ }
}
printf("\nDisconnected from Asterisk server\n");
}
@@ -2433,13 +2439,21 @@ int main(int argc, char *argv[])
break;
}
}
+ if (need_reload) {
+ need_reload = 0;
+ ast_module_reload(NULL);
+ }
}
-
}
/* Do nothing */
for(;;) { /* apparently needed for the MACos */
struct pollfd p = { -1 /* no descriptor */, 0, 0 };
poll(&p, 0, -1);
+ /* SIGHUP will cause this to break out of poll() */
+ if (need_reload) {
+ need_reload = 0;
+ ast_module_reload(NULL);
+ }
}
return 0;
}