- GUI RPC client side: set up a 30 second receive timeout for

socket to client.  That way GUI won't hang if client does.
    From Fred of BoincTasks

svn path=/trunk/boinc/; revision=21663
This commit is contained in:
David Anderson 2010-05-31 21:51:09 +00:00
parent da81446c1b
commit 0f2440c90b
3 changed files with 21 additions and 3 deletions

View File

@ -3905,3 +3905,12 @@ Rom 28 May 2010
boinc.sln
cuda.rules
cuda.vcproj
David 31 May 2010
- GUI RPC client side: set up a 30 second receive timeout for
socket to client. That way GUI won't hang if client does.
From Fred of BoincTasks
lib/
network.cpp
gui_rpc_client.cpp

View File

@ -96,6 +96,15 @@ int RPC_CLIENT::init(const char* host, int port) {
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
}
boinc_socket(sock);
// set up receive timeout; avoid hang if client doesn't respond
//
struct timeval tv;
tv.tv_sec = 30;
tv.tv_usec = 0;
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof tv)) {
// not fatal
}
retval = connect(sock, (const sockaddr*)(&addr), sizeof(addr));
if (retval) {
#ifdef _WIN32

View File

@ -194,7 +194,7 @@ int get_socket_error(int fd) {
int WinsockInitialize() {
WSADATA wsdata;
return WSAStartup( MAKEWORD( 1, 1 ), &wsdata);
return WSAStartup(MAKEWORD(2, 0), &wsdata);
}
int WinsockCleanup() {