mirror of https://github.com/BOINC/boinc.git
- 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:
parent
da81446c1b
commit
0f2440c90b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -90,8 +90,8 @@ const char* socket_error_str() {
|
|||
return "host not found or server failure";
|
||||
#ifdef NETDB_INTERNAL
|
||||
case NETDB_INTERNAL:
|
||||
sprintf(buf,"network internal error %d",errno);
|
||||
return buf;
|
||||
sprintf(buf,"network internal error %d",errno);
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
sprintf(buf, "error %d", h_errno);
|
||||
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue