diff --git a/checkin_notes b/checkin_notes index ec60fd05f8..c48b16acd5 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7020,3 +7020,13 @@ David 24 May 2005 lib/ prefs.C,h result_state.h + +Rom 24 May 2005 + - Instead of going to sleep to give the CC enough time to open a + listening socket we should attempt to connect after we have received + our first OnFrameRender timer event which will happen after at + least one window idle event. + + clientgui/ + BOINCGUIApp.cpp + MainFrame.cpp, .h diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 2f267cc00f..9a706991c3 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -451,7 +451,7 @@ void CBOINCGUIApp::StartupBOINCCore() { #ifndef __WXMAC__ // Append boinc.exe to the end of the strExecute string and get ready to rock - strExecute += wxT("/boinc"); + strExecute += wxT("boinc"); #endif // ! __WXMAC__ @@ -462,11 +462,6 @@ void CBOINCGUIApp::StartupBOINCCore() { if (0 != m_lBOINCCoreProcessId) { m_bBOINCStartedByManager = true; } - - // Sleep for 5 seconds to avoid connection failures that might occur if - // the core client has not opened any sockets by the next time we - // request network IO - ::wxSleep(5); } } diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index d6a6781373..628919f8cc 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -220,10 +220,12 @@ CMainFrame::CMainFrame(wxString strTitle) : SetStatusBarPane(0); - // Complete any remaining initialization that has to happen after we are up - // and running - CMainFrameEvent event(wxEVT_MAINFRAME_INITIALIZED, this); - AddPendingEvent(event); + // The second half of the initialization process picks up in the OnFrameRender() + // routine since the menus' and status bars' are drawn in the frameworks + // on idle routines, on idle events are sent in between the end of the + // constructor and the first call to OnFrameRender + // + // Look for the 'if (!bAlreadyRunOnce) {' statement wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CMainFrame - Function End")); } @@ -1163,8 +1165,9 @@ void CMainFrame::OnInitialized(CMainFrameEvent&) { wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - if (!pDoc->IsConnected()) + if (!pDoc->IsConnected()) { pDoc->Connect(wxEmptyString, wxEmptyString, TRUE); + } wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnInitialized - Function End")); } @@ -1228,14 +1231,22 @@ void CMainFrame::OnRefreshState(wxTimerEvent &event) { void CMainFrame::OnFrameRender(wxTimerEvent &event) { wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnFrameRender - Function Begin")); - CMainDocument* pDoc = wxGetApp().GetDocument(); static bool bAlreadyRunningLoop = false; + static bool bAlreadyRunOnce = false; + CMainDocument* pDoc = wxGetApp().GetDocument(); if (!bAlreadyRunningLoop) { bAlreadyRunningLoop = true; wxGetApp().UpdateSystemIdleDetection(); + if (!bAlreadyRunOnce) { + // Complete any remaining initialization that has to happen after we are up + // and running + FireInitialize(); + bAlreadyRunOnce = true; + } + if (IsShown()) { if (pDoc) { wxASSERT(wxDynamicCast(pDoc, CMainDocument)); @@ -1401,6 +1412,12 @@ void CMainFrame::UpdateStatusText(const wxChar* szStatus) { } +void CMainFrame::FireInitialize() { + CMainFrameEvent event(wxEVT_MAINFRAME_INITIALIZED, this); + AddPendingEvent(event); +} + + void CMainFrame::FireConnect() { CMainFrameEvent event(wxEVT_MAINFRAME_CONNECT, this); AddPendingEvent(event); diff --git a/clientgui/MainFrame.h b/clientgui/MainFrame.h index 183c0bbbc0..4e014b1bd4 100644 --- a/clientgui/MainFrame.h +++ b/clientgui/MainFrame.h @@ -89,6 +89,7 @@ public: void UpdateStatusText( const wxChar* szStatus ); + void FireInitialize(); void FireConnect(); void FireConnectError(); void FireConnectErrorAuthentication();