diff options
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r-- | src/ipcpd/ipcp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index a9f2b77b..784d845a 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -113,6 +113,9 @@ void * ipcp_main_loop(void * o) char * sock_path; + struct timeval tv = {(SOCKET_TIMEOUT / 1000), + (SOCKET_TIMEOUT % 1000) * 1000}; + if (_ipcp == NULL) { LOG_ERR("Invalid ipcp struct."); return (void *) 1; @@ -141,6 +144,10 @@ void * ipcp_main_loop(void * o) break; } + if (setsockopt(lsockfd, SOL_SOCKET, SO_RCVTIMEO, + (void *) &tv, sizeof(tv))) + LOG_WARN("Failed to set timeout on socket."); + pthread_cleanup_push(close_ptr, (void *) &lsockfd); count = read(lsockfd, buf, IPCP_MSG_BUF_SIZE); |