From 9254469110cb5a2602bd50d1721e0bc9885be64f Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 22 Dec 2012 02:38:59 -0800 Subject: [PATCH] Mgr: Allow existing to retrieve images or other items from the Internet even if network activity is suspended. (But client won't get new notices.) --- checkin_notes | 4 ++++ clientgui/BOINCInternetFSHandler.cpp | 35 +++------------------------- clientgui/ViewNotices.cpp | 26 ++++----------------- clientgui/ViewNotices.h | 1 - 4 files changed, 12 insertions(+), 54 deletions(-) diff --git a/checkin_notes b/checkin_notes index d6cd5dacc2..8e3ce0168f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7859,5 +7859,9 @@ David 21 Dec 2012 Charlie 22 Dec 2012 - Mgr: When removing entries from our hash table, delete data to avoid memory leaks. + -Mgr: Allow existing to retrieve images or other items from the Internet even + if network activity is suspended. (But client won't get new notices.) + clientgui/ BOINCInternetFSHandler.cpp + ViewNotices.cpp,.h diff --git a/clientgui/BOINCInternetFSHandler.cpp b/clientgui/BOINCInternetFSHandler.cpp index be002730b4..0fb721b019 100755 --- a/clientgui/BOINCInternetFSHandler.cpp +++ b/clientgui/BOINCInternetFSHandler.cpp @@ -524,40 +524,11 @@ 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__ - // Use WinInet functions 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) { - unsigned char cache_info[2048]; - DWORD len = sizeof(cache_info); - if (!GetUrlCacheEntryInfo(right.c_str(), - (LPINTERNET_CACHE_ENTRY_INFO)cache_info, - &len) - ) { - CanUseWinInet = false; - } - } - - if (CanUseWinInet) { - wxWinINetURL * winURL = new wxWinINetURL; - m_InputStream = winURL->GetInputStream(&url); - } else { - m_InputStream = NULL; - } + wxWinINetURL * winURL = new wxWinINetURL; + m_InputStream = winURL->GetInputStream(&url); #else - // 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(); - } + m_InputStream = url.GetInputStream(); #endif strMIME = url.GetProtocol().GetContentType(); if (strMIME == wxEmptyString) { diff --git a/clientgui/ViewNotices.cpp b/clientgui/ViewNotices.cpp index 7708bb0cdf..1840e942ed 100755 --- a/clientgui/ViewNotices.cpp +++ b/clientgui/ViewNotices.cpp @@ -56,10 +56,10 @@ CViewNotices::CViewNotices(wxNotebook* pNotebook) : wxFlexGridSizer* itemReloadButtonSizer = new wxFlexGridSizer(1, 2, 0, 0); itemReloadButtonSizer->AddGrowableCol(1); - m_ReloadNoticesText = new wxStaticText( - this, wxID_ANY, wxEmptyString, - wxDefaultPosition, wxDefaultSize, 0 - ); + m_ReloadNoticesText = new wxStaticText(this, wxID_ANY, + _("One or more items failed to load from the Internet."), + wxDefaultPosition, wxDefaultSize, 0 + ); itemReloadButtonSizer->Add(m_ReloadNoticesText, 1, wxALL, 5); @@ -102,7 +102,6 @@ CViewNotices::CViewNotices(wxNotebook* pNotebook) : m_ReloadNoticesButton->Hide(); m_bMissingItems = false; - m_bNetworkSuspended = -1; } @@ -186,26 +185,11 @@ void CViewNotices::OnListRender(wxTimerEvent& WXUNUSED(event)) { m_pHtmlListPane->UpdateUI(); bMissingItems = ((CBOINCInternetFSHandler*)internetFSHandler)->ItemsFailedToLoad(); - if (bMissingItems) { - int retval = pDoc->GetCoreClientStatus(status); - if ((!retval) && (m_bNetworkSuspended != status.network_suspend_reason)) { - if (status.network_suspend_reason) { - m_ReloadNoticesText->SetLabel(_( - "One or more items failed to load from the Internet\nbecause Network activity is suspended.")); - } else { - m_ReloadNoticesText->SetLabel(_("One or more items failed to load from the Internet.")); - } - } - } - - if ((bMissingItems != m_bMissingItems) || - (m_bNetworkSuspended != status.network_suspend_reason) - ) { + if (bMissingItems != m_bMissingItems) { m_ReloadNoticesText->Show(bMissingItems); m_ReloadNoticesButton->Show(bMissingItems); Layout(); m_bMissingItems = bMissingItems; - m_bNetworkSuspended = status.network_suspend_reason; } m_FetchingNoticesText->Show(m_pHtmlListPane->m_bDisplayFetchingNotices); diff --git a/clientgui/ViewNotices.h b/clientgui/ViewNotices.h index 6ba542ea62..e8176f1ccc 100755 --- a/clientgui/ViewNotices.h +++ b/clientgui/ViewNotices.h @@ -53,7 +53,6 @@ protected: wxStaticText* m_FetchingNoticesText; wxStaticText* m_NoNoticesText; bool m_bMissingItems; - int m_bNetworkSuspended; virtual bool OnSaveState( wxConfigBase* pConfig ); virtual bool OnRestoreState( wxConfigBase* pConfig );