summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-udp/main.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2017-01-04 16:43:24 +0100
committerSander Vrijders <[email protected]>2017-01-04 16:43:24 +0100
commitc9b54bcd27fe87559f82b9a1cebba9b38abf5ebc (patch)
tree8190cda7271de35bae0725240e29ea33fce1ddc3 /src/ipcpd/shim-udp/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/shim-udp/main.c')
-rw-r--r--src/ipcpd/shim-udp/main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 9bc8f287..8c0c0aac 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -1180,11 +1180,13 @@ int main(int argc, char * argv[])
}
if (ap_init(NULL) < 0) {
+ LOG_ERR("Failed to init application.");
close_logfile();
exit(EXIT_FAILURE);
}
if (udp_data_init() < 0) {
+ LOG_ERR("Failed to init shim-udp data.");
close_logfile();
exit(EXIT_FAILURE);
}
@@ -1204,9 +1206,16 @@ int main(int argc, char * argv[])
sigaction(SIGHUP, &sig_act, NULL);
sigaction(SIGPIPE, &sig_act, NULL);
+ if (ipcp_init(THIS_TYPE, &udp_ops) < 0) {
+ LOG_ERR("Failed to init IPCP.");
+ close_logfile();
+ exit(EXIT_FAILURE);
+ }
+
pthread_sigmask(SIG_BLOCK, &sigset, NULL);
- if (ipcp_init(THIS_TYPE, &udp_ops) < 0) {
+ if (ipcp_boot() < 0) {
+ LOG_ERR("Failed to boot IPCP.");
close_logfile();
exit(EXIT_FAILURE);
}
@@ -1219,7 +1228,7 @@ int main(int argc, char * argv[])
exit(EXIT_FAILURE);
}
- ipcp_fini();
+ ipcp_shutdown();
if (ipcp_get_state() == IPCP_SHUTDOWN) {
pthread_cancel(udp_data.handler);
@@ -1230,6 +1239,8 @@ int main(int argc, char * argv[])
pthread_join(udp_data.sdu_reader, NULL);
}
+ ipcp_fini();
+
udp_data_fini();
ap_fini();