Mgr: If network activity is suspended, don't retrieve URL references within notices unless they are already in our cache or in the Windows cache

This commit is contained in:
Charlie Fenton 2012-12-21 02:07:57 -08:00 committed by Oliver Bock
parent c5e31b7d95
commit 09ff603a13
2 changed files with 34 additions and 3 deletions

View File

@ -7829,3 +7829,10 @@ Rom 20 Dec 2012
vboxwrapper.cpp
win_build\
vboxwrapper.vcproj
Charlie 21 Dec 2012
- Mgr: If network activity is suspended, don't retrieve URL references within
notices unless they are already in our cache or in the Windows cache.
clientgui/
BOINCInternetFSHandler.cpp

View File

@ -524,12 +524,36 @@ wxFSFile* CBOINCInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wx
wxURL url(right);
if (url.GetError() == wxURL_NOERR)
{
CC_STATUS status;
CMainDocument* pDoc = wxGetApp().GetDocument();
int retval = pDoc->GetCoreClientStatus(status);
#ifdef __WXMSW__
wxWinINetURL * winURL = new wxWinINetURL;
wxInputStream* m_InputStream = winURL->GetInputStream(&url);
// Use WinInet fucntions only if network activity not suspended
// or if the result is already in the Windows internet cache
bool CanUseWinInet = true;
if ((!retval) && status.network_suspend_reason) {
INTERNET_CACHE_ENTRY_INFO cache_info;
if (!GetUrlCacheEntryInfo(right.c_str(), sizeof(cache_info))) {
CanUseWinInet = false;
}
}
if (CanUseWinInet) {
wxWinINetURL * winURL = new wxWinINetURL;
m_InputStream = winURL->GetInputStream(&url);
} else {
m_InputStream = NULL;
}
#else
wxInputStream* m_InputStream = url.GetInputStream();
// Mac OS does not cache BOINC's Internet accesses
// so just check if network activity os suspended
// TODO: Does Linux OS cache BOINC's Internet accesses?
if (retval || status.network_suspend_reason) {
m_InputStream = NULL;
} else {
m_InputStream = url.GetInputStream();
}
#endif
strMIME = url.GetProtocol().GetContentType();
if (strMIME == wxEmptyString) {