diff options
Diffstat (limited to 'common/ipc-client.c')
-rw-r--r-- | common/ipc-client.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/ipc-client.c b/common/ipc-client.c index 13e2dfa3..b6c03d13 100644 --- a/common/ipc-client.c +++ b/common/ipc-client.c | |||
@@ -69,6 +69,16 @@ int ipc_open_socket(const char *socket_path) { | |||
69 | return socketfd; | 69 | return socketfd; |
70 | } | 70 | } |
71 | 71 | ||
72 | bool ipc_set_recv_timeout(int socketfd, struct timeval tv) { | ||
73 | if (setsockopt(socketfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { | ||
74 | sway_log_errno(SWAY_ERROR, "Failed to set ipc recv timeout"); | ||
75 | return false; | ||
76 | } | ||
77 | sway_log(SWAY_DEBUG, "ipc recv timeout set to %ld.%06ld", | ||
78 | tv.tv_sec, tv.tv_usec); | ||
79 | return true; | ||
80 | } | ||
81 | |||
72 | struct ipc_response *ipc_recv_response(int socketfd) { | 82 | struct ipc_response *ipc_recv_response(int socketfd) { |
73 | char data[IPC_HEADER_SIZE]; | 83 | char data[IPC_HEADER_SIZE]; |
74 | uint32_t *data32 = (uint32_t *)(data + sizeof(ipc_magic)); | 84 | uint32_t *data32 = (uint32_t *)(data + sizeof(ipc_magic)); |