summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-08-16 07:01:49 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-08-16 07:01:49 +0000
commitc8283ea410e7d640537303c6b644bbc3afb35cd5 (patch)
tree57a4d386fcc20cd7bbef330a246357ed3cfdae35 /src/ipcpd/normal
parentc3d9dbe4971549c8d2f8f821f06dcaa1dce90073 (diff)
parenta27bef54052b81406ba3142be3da4ab2a6330de6 (diff)
downloadouroboros-c8283ea410e7d640537303c6b644bbc3afb35cd5.tar.gz
ouroboros-c8283ea410e7d640537303c6b644bbc3afb35cd5.zip
Merged in dstaesse/ouroboros/be-single-accept (pull request #553)
Be single accept
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/fa.c2
-rw-r--r--src/ipcpd/normal/main.c59
2 files changed, 26 insertions, 35 deletions
diff --git a/src/ipcpd/normal/fa.c b/src/ipcpd/normal/fa.c
index 06f10b53..2488f017 100644
--- a/src/ipcpd/normal/fa.c
+++ b/src/ipcpd/normal/fa.c
@@ -287,6 +287,8 @@ int fa_alloc_resp(int fd,
struct shm_du_buff * sdb;
qoscube_t qc;
+ clock_gettime(PTHREAD_COND_CLOCK, &abstime);
+
pthread_mutex_lock(&ipcpi.alloc_lock);
while (ipcpi.alloc_id != fd && ipcp_get_state() == IPCP_OPERATIONAL) {
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 325c1285..27fefdb6 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -366,66 +366,39 @@ int main(int argc,
char * argv[])
{
if (ipcp_init(argc, argv, THIS_TYPE, &normal_ops) < 0) {
- ipcp_create_r(getpid(), -1);
- exit(EXIT_FAILURE);
+ log_err("Failed to init IPCP.");
+ goto fail_init;
}
if (irm_bind_api(getpid(), ipcpi.name)) {
log_err("Failed to bind AP name.");
- ipcp_create_r(getpid(), -1);
- ipcp_fini();
- exit(EXIT_FAILURE);
+ goto fail_bind_api;
}
if (rib_init()) {
log_err("Failed to initialize RIB.");
- ipcp_create_r(getpid(), -1);
- irm_unbind_api(getpid(), ipcpi.name);
- ipcp_fini();
- exit(EXIT_FAILURE);
+ goto fail_rib_init;
}
if (connmgr_init()) {
log_err("Failed to initialize connection manager.");
- ipcp_create_r(getpid(), -1);
- rib_fini();
- irm_unbind_api(getpid(), ipcpi.name);
- ipcp_fini();
- exit(EXIT_FAILURE);
+ goto fail_connmgr_init;
}
if (enroll_init()) {
log_err("Failed to initialize enroll component.");
- ipcp_create_r(getpid(), -1);
- connmgr_fini();
- rib_fini();
- irm_unbind_api(getpid(), ipcpi.name);
- ipcp_fini();
- exit(EXIT_FAILURE);
+ goto fail_enroll_init;
}
-
if (ipcp_boot() < 0) {
log_err("Failed to boot IPCP.");
- ipcp_create_r(getpid(), -1);
- enroll_fini();
- connmgr_fini();
- rib_fini();
- irm_unbind_api(getpid(), ipcpi.name);
- ipcp_fini();
- exit(EXIT_FAILURE);
+ goto fail_boot;
}
if (ipcp_create_r(getpid(), 0)) {
log_err("Failed to notify IRMd we are initialized.");
ipcp_set_state(IPCP_NULL);
- ipcp_shutdown();
- enroll_fini();
- connmgr_fini();
- rib_fini();
- irm_unbind_api(getpid(), ipcpi.name);
- ipcp_fini();
- exit(EXIT_FAILURE);
+ goto fail_create_r;
}
ipcp_shutdown();
@@ -444,4 +417,20 @@ int main(int argc,
ipcp_fini();
exit(EXIT_SUCCESS);
+
+ fail_create_r:
+ ipcp_shutdown();
+ fail_boot:
+ enroll_fini();
+ fail_enroll_init:
+ connmgr_fini();
+ fail_connmgr_init:
+ rib_fini();
+ fail_rib_init:
+ irm_unbind_api(getpid(), ipcpi.name);
+ fail_bind_api:
+ ipcp_fini();
+ fail_init:
+ ipcp_create_r(getpid(), -1);
+ exit(EXIT_FAILURE);
}