mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
use setsockopt to limit read() block time and so to prevent linux
version from being unkillable when relay crashes at the wrong time.
This commit is contained in:
parent
25e65d3e6f
commit
c98bbe2b9a
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue