*** empty log message ***

svn path=/trunk/boinc/; revision=9434
This commit is contained in:
Rom Walton 2006-02-09 23:55:40 +00:00
parent e17ff6c4ab
commit c259f18b99
2 changed files with 37 additions and 15 deletions

View File

@ -71,7 +71,6 @@ size_t CBOINCDialUpManager::GetISPNames(wxArrayString& names) {
void CBOINCDialUpManager::poll() { void CBOINCDialUpManager::poll() {
CMainDocument* pDoc = wxGetApp().GetDocument(); CMainDocument* pDoc = wxGetApp().GetDocument();
CMainFrame* pFrame = wxGetApp().GetFrame(); CMainFrame* pFrame = wxGetApp().GetFrame();
@ -115,28 +114,45 @@ void CBOINCDialUpManager::poll() {
m_dtLastDialupRequest = wxDateTime((time_t)0); m_dtLastDialupRequest = wxDateTime((time_t)0);
} }
// Log out the trace information for debugging purposes.
wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Dialup Flags"));
wxLogTrace(wxT("Function Status"),
wxT("CBOINCDialUpManager::poll - -- bIsOnline = '%d', bIsDialing = '%d', m_bWasDialing = '%d', bWantConnection = '%d'"),
bIsOnline, bIsDialing, m_bWasDialing, bWantConnection
);
wxLogTrace(wxT("Function Status"),
wxT("CBOINCDialUpManager::poll - -- m_bResetTimers = '%d', m_bNotifyConnectionAvailable = '%d', m_bConnectedSuccessfully = '%d'"),
m_bResetTimers, m_bNotifyConnectionAvailable, m_bConnectedSuccessfully
);
wxLogTrace(wxT("Function Status"),
wxT("CBOINCDialUpManager::poll - -- confirm_before_connecting = '%d', hangup_if_dialed = '%d'"),
pDoc->state.global_prefs.confirm_before_connecting, pDoc->state.global_prefs.hangup_if_dialed
);
if (!bIsOnline && !bIsDialing && !m_bWasDialing && bWantConnection) if (!bIsOnline && !bIsDialing && !m_bWasDialing && bWantConnection)
{ {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Internet connection needed")); wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Internet connection needed"));
if (!pFrame->IsShown()) { if (!pFrame->IsShown()) {
// BOINC Manager is hidden and displaying a dialog might interupt what they // BOINC Manager is hidden and displaying a dialog might interupt what they
// are doing. // are doing.
NotifyNeedConnection(); NotifyUserNeedConnection();
} else { } else {
// BOINC Manager is visable and can process user input. // BOINC Manager is visable and can process user input.
Connect(); Connect();
} }
} else if (!bIsDialing && !m_bWasDialing) { } else if (!bIsDialing && !m_bWasDialing) {
// We are not doing anything now, were we up to something before?
if (bIsOnline && bWantConnection && m_bConnectedSuccessfully && !m_bNotifyConnectionAvailable) { if (bIsOnline && bWantConnection && m_bConnectedSuccessfully && !m_bNotifyConnectionAvailable) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, notifing user of update to all projects")); // Ah ha, we are online and we initiated the connection, so we need to
ConnectionDetected(); // notify the CC that the network is available.
NetworkAvailable();
} else if (bIsOnline && bWantDisconnect && m_bConnectedSuccessfully ) { } else if (bIsOnline && bWantDisconnect && m_bConnectedSuccessfully ) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, disconnect requested via the CC.")); // We are online, and the CC says it is safe to disconnect. Since we
// initiated the connection we need to disconnect now.
Disconnect(); Disconnect();
} }
} else if (!bIsDialing && m_bWasDialing) { } else if (!bIsDialing && m_bWasDialing) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - We were dialing and now we are not, detect success or failure of the connection.")); wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - We were dialing and now we are not, detect success or failure of the connection."));
m_bWasDialing = false; m_bWasDialing = false;
m_bResetTimers = true; m_bResetTimers = true;
if (bIsOnline) { if (bIsOnline) {
@ -145,14 +161,14 @@ void CBOINCDialUpManager::poll() {
ConnectionFailed(); ConnectionFailed();
} }
} else if (bIsDialing && !m_bWasDialing) { } else if (bIsDialing && !m_bWasDialing) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - We are now dialing, where before we were not.")); wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - We are now dialing, where before we were not."));
m_bWasDialing = true; m_bWasDialing = true;
} }
} }
} }
int CBOINCDialUpManager::NotifyNeedConnection() { int CBOINCDialUpManager::NotifyUserNeedConnection() {
CMainFrame* pFrame = wxGetApp().GetFrame(); CMainFrame* pFrame = wxGetApp().GetFrame();
wxTimeSpan tsLastDialupAlertSent; wxTimeSpan tsLastDialupAlertSent;
wxString strDialogMessage = wxEmptyString; wxString strDialogMessage = wxEmptyString;
@ -162,7 +178,7 @@ int CBOINCDialUpManager::NotifyNeedConnection() {
tsLastDialupAlertSent = wxDateTime::Now() - m_dtLastDialupAlertSent; tsLastDialupAlertSent = wxDateTime::Now() - m_dtLastDialupAlertSent;
if (tsLastDialupAlertSent.GetSeconds() >= (pFrame->GetReminderFrequency() * 60)) { if (tsLastDialupAlertSent.GetSeconds() >= (pFrame->GetReminderFrequency() * 60)) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Manager not shown, notify instead")); wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Manager not shown, notify instead"));
m_dtLastDialupAlertSent = wxDateTime::Now(); m_dtLastDialupAlertSent = wxDateTime::Now();
@ -207,7 +223,7 @@ int CBOINCDialUpManager::Connect() {
tsLastDialupRequest = wxDateTime::Now() - m_dtLastDialupRequest; tsLastDialupRequest = wxDateTime::Now() - m_dtLastDialupRequest;
if (tsLastDialupRequest.GetSeconds() >= (pFrame->GetReminderFrequency() * 60)) { if (tsLastDialupRequest.GetSeconds() >= (pFrame->GetReminderFrequency() * 60)) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Begin connection process")); wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Begin connection process"));
m_dtLastDialupRequest = wxDateTime::Now(); m_dtLastDialupRequest = wxDateTime::Now();
@ -320,7 +336,7 @@ int CBOINCDialUpManager::ConnectionFailed() {
} }
int CBOINCDialUpManager::ConnectionDetected() { int CBOINCDialUpManager::NetworkAvailable() {
CMainDocument* pDoc = wxGetApp().GetDocument(); CMainDocument* pDoc = wxGetApp().GetDocument();
CMainFrame* pFrame = wxGetApp().GetFrame(); CMainFrame* pFrame = wxGetApp().GetFrame();
wxString strDialogMessage = wxEmptyString; wxString strDialogMessage = wxEmptyString;
@ -330,6 +346,8 @@ int CBOINCDialUpManager::ConnectionDetected() {
wxASSERT(pFrame); wxASSERT(pFrame);
wxASSERT(wxDynamicCast(pFrame, CMainFrame)); wxASSERT(wxDynamicCast(pFrame, CMainFrame));
wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Connection Detected, notifing user of update to all projects"));
m_bNotifyConnectionAvailable = true; m_bNotifyConnectionAvailable = true;
// We are already online but BOINC for some reason is in a state // We are already online but BOINC for some reason is in a state
@ -368,8 +386,11 @@ int CBOINCDialUpManager::Disconnect() {
wxASSERT(pFrame); wxASSERT(pFrame);
wxASSERT(wxDynamicCast(pFrame, CMainFrame)); wxASSERT(wxDynamicCast(pFrame, CMainFrame));
wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Connection Detected, disconnect requested via the CC."));
if (pDoc->state.global_prefs.hangup_if_dialed) { if (pDoc->state.global_prefs.hangup_if_dialed) {
wxLogTrace(wxT("Function Status"), wxT("CMainFrame::OnFrameRender - Connection Detected, Don't need the network, Hanging up.")); wxLogTrace(wxT("Function Status"), wxT("CBOINCDialUpManager::poll - Connection Detected, Don't need the network, Hanging up."));
if (m_pDialupManager->HangUp()) { if (m_pDialupManager->HangUp()) {
// %s is the project name // %s is the project name

View File

@ -37,12 +37,13 @@ public:
void poll(); void poll();
int NotifyNeedConnection(); int NotifyUserNeedConnection();
int Connect(); int Connect();
int ConnectionSucceeded(); int ConnectionSucceeded();
int ConnectionFailed(); int ConnectionFailed();
int ConnectionDetected(); int NetworkAvailable();
int Disconnect(); int Disconnect();