mirror of https://github.com/BOINC/boinc.git
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.)
This commit is contained in:
parent
a31f4df97b
commit
9254469110
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue