diff options
Diffstat (limited to 'src/irmd/ipcp.c')
-rw-r--r-- | src/irmd/ipcp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index a8263580..eb0c2de0 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -53,10 +53,12 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t api, char * sock_path = NULL; ssize_t count = 0; ipcp_msg_t * recv_msg = NULL; - struct timeval tv = {(SOCKET_TIMEOUT / 1000), (SOCKET_TIMEOUT % 1000) * 1000}; + if (kill(api, 0) < 0) + return NULL; + sock_path = ipcp_sock_path(api); if (sock_path == NULL) return NULL; @@ -67,10 +69,6 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t api, return NULL; } - if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, - (void *) &tv, sizeof(tv))) - log_warn("Failed to set timeout on socket."); - free(sock_path); buf.len = ipcp_msg__get_packed_size(msg); @@ -85,6 +83,10 @@ ipcp_msg_t * send_recv_ipcp_msg(pid_t api, return NULL; } + if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, + (void *) &tv, sizeof(tv))) + log_warn("Failed to set timeout on socket."); + pthread_cleanup_push(close_ptr, (void *) &sockfd); pthread_cleanup_push((void (*)(void *)) free, (void *) buf.data); @@ -184,7 +186,7 @@ int ipcp_destroy(pid_t api) return 0; } -int ipcp_bootstrap(pid_t api, +int ipcp_bootstrap(pid_t api, dif_config_msg_t * conf) { ipcp_msg_t msg = IPCP_MSG__INIT; |