From b45b23df1b1e2aedcd6c4949d65ad199d87e824a Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Thu, 20 Feb 2003 00:12:30 +0000 Subject: [PATCH] windows async select svn path=/trunk/boinc/; revision=949 --- client/client_state.C | 2 +- client/net_xfer.C | 12 +++++++++++- client/win/wingui_mainwindow.h | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/client/client_state.C b/client/client_state.C index 2453a453ef..1df6a98778 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -74,7 +74,7 @@ CLIENT_STATE::CLIENT_STATE() { platform_name = HOST; exit_after_app_start_secs = 0; app_started = 0; - max_transfer_rate = 9999; + max_transfer_rate = 999999999; max_bytes = 0; user_idle = true; use_http_proxy = false; diff --git a/client/net_xfer.C b/client/net_xfer.C index 69cedd853f..562e81212a 100644 --- a/client/net_xfer.C +++ b/client/net_xfer.C @@ -22,8 +22,10 @@ #include #ifdef _WIN32 -#include "winsock.h" +#include +#include #include "Win_net.h" +#include "wingui_mainwindow.h" #endif #if HAVE_SYS_TIME_H @@ -125,6 +127,14 @@ int NET_XFER::open_server() { NetClose(); return -1; } + if (WSAAsyncSelect( fd, g_myWnd->GetSafeHwnd(), WM_TIMER, FD_READ|FD_WRITE )) { + errno = WSAGetLastError(); + if (errno != WSAEINPROGRESS && errno != WSAEWOULDBLOCK) { + closesocket(fd); + NetClose(); + return -1; + } + } #else if (errno != EINPROGRESS) { close(fd); diff --git a/client/win/wingui_mainwindow.h b/client/win/wingui_mainwindow.h index 3f0565f624..624cbd04b1 100755 --- a/client/win/wingui_mainwindow.h +++ b/client/win/wingui_mainwindow.h @@ -42,7 +42,7 @@ #define EDGE_BUFFER 2 // buffer pixels around edge of client #define ID_TIMER 104 // timer id -#define TIMEOUT_WAIT 100 // timeout sleep time (in milliseconds) +#define TIMEOUT_WAIT 1000 // timeout sleep time (in milliseconds) #define STATUS_ICON_ID (WM_USER + 1) // id for notifications from status icon