summaryrefslogtreecommitdiff
path: root/src/irmd/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-04-06 09:30:01 +0000
committerSander Vrijders <[email protected]>2017-04-06 09:30:01 +0000
commit34ef0da6c1b3a3419dbdf2041ed1e3ba107dc915 (patch)
treed8e793cffbe829d64855eaa5a429b90ebe3dc3a4 /src/irmd/ipcp.c
parentc6ad4f96f8bb2f1ee749e92308e7173523ddd0b8 (diff)
parente1c0714d5827cd927961f3a687d9720e6e9aa802 (diff)
downloadouroboros-34ef0da6c1b3a3419dbdf2041ed1e3ba107dc915.tar.gz
ouroboros-34ef0da6c1b3a3419dbdf2041ed1e3ba107dc915.zip
Merged in dstaesse/ouroboros/be-tim (pull request #464)
lib, irmd: Implement flow allocation timeout
Diffstat (limited to 'src/irmd/ipcp.c')
-rw-r--r--src/irmd/ipcp.c14
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;