summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-28 14:46:16 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-28 14:50:39 +0100
commit9766166aa944fc6d8754f1b2c5262d7044690c50 (patch)
tree4df426929dafce4420f4a833f029435bc86c28b7 /src
parent0f7c35900c3efc1c746f830f9304ab09b1afbc7d (diff)
downloadouroboros-9766166aa944fc6d8754f1b2c5262d7044690c50.tar.gz
ouroboros-9766166aa944fc6d8754f1b2c5262d7044690c50.zip
ipcpd: Wait for operational state to start fmgr
The main thread will wait for the IPCP_OPERATIONAL state before starting the fmgr main thread by calling fmgr_init(), instead of the fmgr itself waiting for that state.
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/fmgr.c16
-rw-r--r--src/ipcpd/normal/main.c12
2 files changed, 10 insertions, 18 deletions
diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c
index f7737b82..d8190572 100644
--- a/src/ipcpd/normal/fmgr.c
+++ b/src/ipcpd/normal/fmgr.c
@@ -78,16 +78,8 @@ static void * fmgr_nm1_acceptor(void * o)
(void) o;
while (true) {
- ipcp_wait_state(IPCP_OPERATIONAL, NULL);
-
- pthread_rwlock_rdlock(&ipcpi.state_lock);
-
- if (ipcp_get_state() == IPCP_SHUTDOWN) {
- pthread_rwlock_unlock(&ipcpi.state_lock);
+ if (ipcp_get_state() == IPCP_SHUTDOWN)
return 0;
- }
-
- pthread_rwlock_unlock(&ipcpi.state_lock);
fd = flow_accept(&ae_name, &qs);
if (fd < 0) {
@@ -594,8 +586,7 @@ int fmgr_np1_post_buf(cep_id_t cep_id, buffer_t * buf)
return ret;
}
-int fmgr_np1_post_sdu(cep_id_t cep_id,
- struct shm_du_buff * sdb)
+int fmgr_np1_post_sdu(cep_id_t cep_id, struct shm_du_buff * sdb)
{
int fd;
@@ -687,8 +678,7 @@ int fmgr_nm1_write_sdu(struct pci * pci, struct shm_du_buff * sdb)
return 0;
}
-int fmgr_nm1_write_buf(struct pci * pci,
- buffer_t * buf)
+int fmgr_nm1_write_buf(struct pci * pci, buffer_t * buf)
{
buffer_t * buffer;
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index 4eb708b4..34ba52da 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -215,22 +215,24 @@ int main(int argc, char * argv[])
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
- if (fmgr_init()) {
+ if (ribmgr_init()) {
+ fmgr_fini();
ipcp_fini();
close_logfile();
exit(EXIT_FAILURE);
}
- if (ribmgr_init()) {
+ if (ipcp_create_r(getpid())) {
+ LOG_ERR("Failed to notify IRMd we are initialized.");
fmgr_fini();
ipcp_fini();
close_logfile();
exit(EXIT_FAILURE);
}
- if (ipcp_create_r(getpid())) {
- LOG_ERR("Failed to notify IRMd we are initialized.");
- fmgr_fini();
+ ipcp_wait_state(IPCP_OPERATIONAL, NULL);
+
+ if (fmgr_init()) {
ipcp_fini();
close_logfile();
exit(EXIT_FAILURE);