summaryrefslogtreecommitdiff
path: root/src/ipcpd/local/main.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-04 16:43:24 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-04 16:43:24 +0100
commitc9b54bcd27fe87559f82b9a1cebba9b38abf5ebc (patch)
tree8190cda7271de35bae0725240e29ea33fce1ddc3 /src/ipcpd/local/main.c
parentbbabc773eccf7fe414428b3c8e4a7d3521ca7582 (diff)
parent4384cd203a958373cf0ab959afb688f9eeba05fc (diff)
downloadouroboros-c9b54bcd27fe87559f82b9a1cebba9b38abf5ebc.tar.gz
ouroboros-c9b54bcd27fe87559f82b9a1cebba9b38abf5ebc.zip
Merged in dstaesse/ouroboros/be-ipcpd (pull request #336)
ipcpd: Add boot and shutdown operations
Diffstat (limited to 'src/ipcpd/local/main.c')
-rw-r--r--src/ipcpd/local/main.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index de8c72c2..01e58b91 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -128,9 +128,6 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGHUP:
case SIGQUIT:
if (info->si_pid == irmd_api) {
- LOG_DBG("IPCP %d terminating by order of %d. Bye.",
- getpid(), info->si_pid);
-
pthread_rwlock_wrlock(&ipcpi.state_lock);
if (ipcp_get_state() == IPCP_INIT)
@@ -367,9 +364,16 @@ int main(int argc, char * argv[])
sigaction(SIGHUP, &sig_act, NULL);
sigaction(SIGPIPE, &sig_act, NULL);
+ if (ipcp_init(THIS_TYPE, &local_ops) < 0) {
+ LOG_ERR("Failed to init IPCP.");
+ close_logfile();
+ exit(EXIT_FAILURE);
+ }
+
pthread_sigmask(SIG_BLOCK, &sigset, NULL);
- if (ipcp_init(THIS_TYPE, &local_ops) < 0) {
+ if (ipcp_boot() < 0) {
+ LOG_ERR("Failed to boot IPCP.");
close_logfile();
exit(EXIT_FAILURE);
}
@@ -382,13 +386,15 @@ int main(int argc, char * argv[])
exit(EXIT_FAILURE);
}
- ipcp_fini();
+ ipcp_shutdown();
if (ipcp_get_state() == IPCP_SHUTDOWN) {
pthread_cancel(local_data.sduloop);
pthread_join(local_data.sduloop, NULL);
}
+ ipcp_fini();
+
local_data_fini();
ap_fini();