From c98bbe2b9afc3667f06ed0951af254c2926ff3b3 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 13 Aug 2012 06:44:16 -0700 Subject: [PATCH] use setsockopt to limit read() block time and so to prevent linux version from being unkillable when relay crashes at the wrong time. --- xwords4/linux/linuxmain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 87cc8b63c..065d7cd6a 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -728,6 +728,10 @@ linux_init_relay_socket( CommonGlobals* cGlobals, const CommsAddrRec* addrRec ) if ( 0 == connect( sock, (const struct sockaddr*)&to_sock, sizeof(to_sock) ) ) { cGlobals->socket = sock; + + struct timeval tv = {0}; + tv.tv_sec = 15; + setsockopt( sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv) ); } else { close( sock ); sock = -1;