From a4f7f6e51f71e2f504c9e8d4359eaaa62386186b Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 8 Jul 2005 06:30:25 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=6578 --- checkin_notes | 9 +++++++++ clientgui/MainFrame.cpp | 18 +++++++++++++++--- clientgui/MainFrame.h | 1 + clientgui/stdwx.h | 1 + 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7f99ed19ea..f6c63f583b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -9017,3 +9017,12 @@ Rom 7 July 2005 gui_rpc_client.C msg_log.h stackwalker_win.cpp + +Rom 7 July 2005 + - Bug Fix: Reduce the amount of time the call to + wxDialUpManager->IsAlwaysOnline takes by preloading the DLL in memory. + - Bug Fix: Only check for an always on connection every 60 seconds. + + clientgui/ + MainFrame.cpp, .h + stdwx.h diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index 5b5eedd340..69a380f241 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -215,6 +215,9 @@ CMainFrame::CMainFrame(wxString strTitle) : #ifdef __WXMSW__ + // Prefetch and Load Wininet.dll so that any calls to + // wxDialUpManager->IsAlwaysOnline happen quicker. + m_WININET.Load(wxT("WININET")); m_pDialupManager = wxDialUpManager::Create(); wxASSERT(m_pDialupManager->IsOk()); #endif @@ -1376,8 +1379,7 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { } #ifdef __WXMSW__ - // Determine if we need to connect to the Internet - // Executes every ten seconds + static wxDateTime dtLastDialupIsAlreadyOnlineCheck = wxDateTime((time_t)0); static wxDateTime dtLastDialupAlertSent = wxDateTime((time_t)0); static wxDateTime dtLastDialupRequest = wxDateTime((time_t)0); static wxDateTime dtFirstDialupDisconnectEvent = wxDateTime((time_t)0); @@ -1385,6 +1387,7 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { static bool connected_successfully = false; static bool reset_timers = false; static bool was_dialing = false; + static bool is_already_online = true; bool should_check_connection = false; bool is_dialing = false; bool is_online = false; @@ -1394,19 +1397,28 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { wxString strConnectionUsername = wxEmptyString; wxString strConnectionPassword = wxEmptyString; wxString strBuffer = wxEmptyString; + wxTimeSpan tsLastDialupIsAlreadyOnlineCheck; wxTimeSpan tsLastDialupAlertSent; wxTimeSpan tsLastDialupRequest; wxTimeSpan tsFirstDialupDisconnectEvent; wxASSERT(m_pDialupManager->IsOk()); if (m_pDialupManager && pDoc) { + // Update the always online flag every 60 seconds. This call is expensive + // on slow machines. + tsLastDialupIsAlreadyOnlineCheck = wxDateTime::Now() - dtLastDialupIsAlreadyOnlineCheck; + if (tsLastDialupIsAlreadyOnlineCheck.GetSeconds() > 60) { + dtLastDialupIsAlreadyOnlineCheck = wxDateTime::Now(); + is_already_online = m_pDialupManager->IsAlwaysOnline(); + } + // Are we configured to detect a network or told one already exists? if (ID_NETWORKLAN != m_iNetworkConnectionType) { if (ID_NETWORKDIALUP == m_iNetworkConnectionType) { should_check_connection = true; } if (ID_NETWORKAUTODETECT == m_iNetworkConnectionType) { - if (!m_pDialupManager->IsAlwaysOnline()) { + if (!is_already_online) { should_check_connection = true; } } diff --git a/clientgui/MainFrame.h b/clientgui/MainFrame.h index ec786a98e3..f0faa18e2f 100644 --- a/clientgui/MainFrame.h +++ b/clientgui/MainFrame.h @@ -107,6 +107,7 @@ private: wxNotebook* m_pNotebook; CStatusBar* m_pStatusbar; #ifdef __WXMSW__ + wxDynamicLibrary m_WININET; wxDialUpManager* m_pDialupManager; #endif wxTimer* m_pRefreshStateTimer; diff --git a/clientgui/stdwx.h b/clientgui/stdwx.h index 86c98069df..2278d83e73 100644 --- a/clientgui/stdwx.h +++ b/clientgui/stdwx.h @@ -94,6 +94,7 @@ #include #include #include +#include #include #ifndef NOTASKBAR