Synergy

Issue Tracker (powered by SPIT)

Bug #2235 - Network connection failure undetected

Status:
Fixed
Priority:
Normal
Assignee:
None
Category:
None
Target:
None
Found:
None
Created by:
Created on:
13 Oct 2005 21:06
Updated by:
None
Updated on:
9 Aug 2010 22:27
Platform:
None
Google ID:
sf-132
Redmine ID:
2267

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

7 Nov 2005 02:03: Issue Importer wrote a comment.

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

7 Nov 2005 22:59: Issue Importer wrote a comment.

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 SO
KEEPALIVE 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,
SO
KEEPALIVE, (char*)&iOptVal, &iOptLen) !=
SOCKET_ERROR) {
printf("SO_KEEPALIVE Value: %%ld\n", iOptVal);
}

if (setsockopt(ListenSocket, SOLSOCKET,
SO
KEEPALIVE, (char*)&bOptVal, bOptLen) !=
SOCKET_ERROR) {
printf("Set SO_KEEPALIVE: ON\n");
}


#3

12 Feb 2006 04:27: Issue Importer wrote a comment.

SourceForge user: crs23

Logged In: YES
user_id=21565

duplicate of 1122816.