diff --git a/checkin_notes b/checkin_notes index 3e17554fb6..d9594e3753 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/clientgui/BOINCInternetFSHandler.cpp b/clientgui/BOINCInternetFSHandler.cpp index 0ecdfd071f..ecccd20588 100755 --- a/clientgui/BOINCInternetFSHandler.cpp +++ b/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) {