Commit 09ff603a authored by Charlie Fenton's avatar Charlie Fenton Committed by Oliver Bock

Mgr: If network activity is suspended, don't retrieve URL references within...

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
parent c5e31b7d
......@@ -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
......@@ -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) {
......
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