Bug #2235 - Network connection failure undetected
SourceForge user: aheisner
I have the syngergy server installed on my laptop and
the client installed on my Solaris workstation at work.
I diconnect my laptop every night to bring it home.
When I re-connect my laptop, the synergy client still
thinks it has a connection so it doesn't initiate a new
one. netstat shows the connection as ESTABLISHED on the
client machine.
I added a setsockopt KEEPALIVE, and this seems to work
now. The synergy server should be closing the
connection upon exit though...
diff -ur synergy-1.2.4/lib/arch/CArchNetworkBSD.cpp
synergy-1.2.4.arh/lib/arch/CArchNetworkBSD.cpp
--- synergy-1.2.4/lib/arch/CArchNetworkBSD.cpp Thu Jul
21 23:12:24 2005
+++ synergy-1.2.4.arh/lib/arch/CArchNetworkBSD.cpp
Thu Oct 13 14:24:46 2005
@ -614,6 +614,14 @
throwError(errno);
}
- flag = 1;
- size = sizeof(flag);
- if (setsockopt(s->mfd, SOLSOCKET, SO_KEEPALIVE,
- (optval_t*)&flag, size) == -1) {
- throwError(errno);
- }
-
return (oflag != 0);
}
#1
SourceForge user: baykelper
Logged In: YES
user_id=1374353
I have a similar situation, however both client and server
computers are Windows, so presumidly
CArchNetworkWinsock.cpp would also need to be updated... --
winsock has a setsockopt and so_keepalive option also, --
will try and dig up some example code.
thanks
GT
(synergy rocks!)
#2
SourceForge user: baykelper
Logged In: YES
user_id=1374353
-- the windows code is similar:
see: http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/winsock/winsock/setsockopt_2.asp
//---------------------------------------
// Initialize variables and call setsockopt.
// The SOKEEPALIVE parameter is a socket option
// that makes the socket send keepalive messages
// on the session. The SOKEEPALIVE socket option
// requires a boolean value to be passed to the
// setsockopt function. If TRUE, the socket is
// configured to send keepalive messages, if FALSE
// the socket configured to NOT send keepalive messages.
// This section of code tests the setsockopt function
// by checking the status of SO_KEEPALIVE on the socket
// using the getsockopt function.
BOOL bOptVal = TRUE;
int bOptLen = sizeof(BOOL);
int iOptVal;
int iOptLen = sizeof(int);
if (getsockopt(ListenSocket, SOLSOCKET,
SOKEEPALIVE, (char*)&iOptVal, &iOptLen) !=
SOCKET_ERROR) {
printf("SO_KEEPALIVE Value: %%ld\n", iOptVal);
}
if (setsockopt(ListenSocket, SOLSOCKET,
SOKEEPALIVE, (char*)&bOptVal, bOptLen) !=
SOCKET_ERROR) {
printf("Set SO_KEEPALIVE: ON\n");
}
Write comment