Commit 81a7299d authored by Charlie Fenton's avatar Charlie Fenton Committed by Oliver Bock

Mgr: Shorten Internet timeout for notices on Windows to 5 seconds

parent d90d77a9
......@@ -7753,3 +7753,9 @@ Charlie 18 Dec 2012
clientgui/
NoticeListCtrl.cpp,.h
ViewNotices.cpp,.h
Charlie 18 Dec 2012
- Mgr: Shorten Internet timeout for notices on Windows to 5 seconds.
clientgui/
BOINCHtmlLBox.cpp
......@@ -15,6 +15,9 @@
#include "BOINCInternetFSHandler.h"
#include "BOINCGUIApp.h"
#include "MainDocument.h"
#include "util.h"
#define STANDARD_INTERNET_DELAY 5
class MemFSHashObj : public wxObject
{
......@@ -240,14 +243,18 @@ size_t wxWinINetInputStream::OnSysRead(void *buffer, size_t bufsize)
bufs.dwBufferLength = (DWORD)bufsize;
lastInternetStatus = 0;
double endtimeout = dtime() + STANDARD_INTERNET_DELAY;
complete = InternetReadFileEx(m_hFile, &bufs, IRF_ASYNC | IRF_USE_CONTEXT, 2);
if (!complete) {
lError = ::GetLastError();
if ((lError == WSAEWOULDBLOCK) || (lError == ERROR_IO_PENDING)){
while (!operationEnded) {
if (b_ShuttingDown || (!pDoc->IsConnected())) {
SetError(wxSTREAM_EOF);
if (b_ShuttingDown ||
(!pDoc->IsConnected()) ||
(dtime() > endtimeout)
) {
SetError(wxSTREAM_EOF);
return 0;
}
wxGetApp().Yield(true);
......@@ -326,7 +333,7 @@ wxInputStream *wxWinINetURL::GetInputStream(wxURL *owner)
{
static bool bAlreadyRunning = false;
if (bAlreadyRunning) {
printf(stderr, "wxWinINetURL::GetInputStream reentered!");
fprintf(stderr, "wxWinINetURL::GetInputStream reentered!");
return NULL;
}
bAlreadyRunning = true;
......@@ -359,6 +366,7 @@ static bool bAlreadyRunning = false;
wxWinINetInputStream *newStream = new wxWinINetInputStream;
operationEnded = false;
double endtimeout = dtime() + STANDARD_INTERNET_DELAY;
HINTERNET newStreamHandle = InternetOpenUrl
(
......@@ -372,7 +380,10 @@ static bool bAlreadyRunning = false;
);
while (!operationEnded) {
if (b_ShuttingDown || (!pDoc->IsConnected())) {
if (b_ShuttingDown ||
(!pDoc->IsConnected()) ||
(dtime() > endtimeout)
) {
GetSessionHandle(); // Closes the session
if (newStreamHandle) {
delete newStreamHandle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment