diff options
Diffstat (limited to 'src/ipcpd/common/connmgr.c')
-rw-r--r-- | src/ipcpd/common/connmgr.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/ipcpd/common/connmgr.c b/src/ipcpd/common/connmgr.c index 4b5fd420..1bb8c932 100644 --- a/src/ipcpd/common/connmgr.c +++ b/src/ipcpd/common/connmgr.c @@ -38,12 +38,6 @@ #include <stdlib.h> #include <string.h> -enum connmgr_state { - CONNMGR_NULL = 0, - CONNMGR_INIT, - CONNMGR_RUNNING -}; - struct conn_el { struct list_head next; struct conn conn; @@ -61,7 +55,6 @@ struct comp { struct { struct comp comps[COMPID_MAX]; - enum connmgr_state state; pthread_t acceptor; } connmgr; @@ -179,6 +172,8 @@ static void * flow_acceptor(void * o) continue; } + fccntl(fd, FLOWSRCVTIMEO, NULL); + err = add_comp_conn(id, fd, qs, &rcv_info); if (err < 0) { log_err("Failed to add new connection: %d.", err); @@ -226,8 +221,6 @@ static void handle_event(void * self, int connmgr_init(void) { - connmgr.state = CONNMGR_INIT; - if (notifier_reg(handle_event, NULL)) { log_err("Failed to register notifier."); return -1; @@ -240,13 +233,10 @@ void connmgr_fini(void) { int i; - notifier_unreg(handle_event); - - if (connmgr.state == CONNMGR_RUNNING) - pthread_join(connmgr.acceptor, NULL); - for (i = 0; i < COMPID_MAX; ++i) connmgr_comp_fini(i); + + notifier_unreg(handle_event); } int connmgr_start(void) @@ -256,15 +246,13 @@ int connmgr_start(void) return -1; } - connmgr.state = CONNMGR_RUNNING; - return 0; } void connmgr_stop(void) { - if (connmgr.state == CONNMGR_RUNNING) - pthread_cancel(connmgr.acceptor); + pthread_cancel(connmgr.acceptor); + pthread_join(connmgr.acceptor, NULL); } int connmgr_comp_init(enum comp_id id, @@ -487,9 +475,6 @@ int connmgr_alloc(enum comp_id id, switch (id) { case COMPID_DT: notifier_event(NOTIFY_DT_CONN_ADD, conn); -#if defined(BUILD_IPCP_UNICAST) && defined(IPCP_CONN_WAIT_DIR) - dir_wait_running(); -#endif break; case COMPID_MGMT: notifier_event(NOTIFY_MGMT_CONN_ADD, conn); @@ -513,7 +498,7 @@ int connmgr_dealloc(enum comp_id id, case COMPID_DT: notifier_event(NOTIFY_DT_CONN_DEL, conn); break; -#if defined(BUILD_IPCP_UNICAST) && defined(IPCP_CONN_WAIT_DIR) +#if defined(BUILD_IPCP_UNICAST) case COMPID_MGMT: notifier_event(NOTIFY_MGMT_CONN_DEL, conn); break; |