Ticket #56: gui_port.patch
File gui_port.patch, 6.6 KB (added by , 17 years ago) |
---|
-
clientgui/AdvancedFrame.cpp
1170 1170 if (wxEmptyString == dlg.m_ComputerNameCtrl->GetValue()) { 1171 1171 lRetVal = pDoc->Connect( 1172 1172 wxT("localhost"), 1173 GUI_RPC_PORT, 1173 1174 wxEmptyString, 1174 1175 TRUE, 1175 1176 TRUE 1176 1177 ); 1177 1178 } else { 1178 1179 // Connect up to the remote machine 1180 wxString sHost = dlg.m_ComputerNameCtrl->GetValue(); 1181 long lPort = GUI_RPC_PORT; 1182 int iPos = sHost.find(_(":")); 1183 if (iPos != -1) { 1184 wxString sPort = sHost.substr(iPos + 1); 1185 if (!sPort.ToLong(&lPort)) 1186 lPort = GUI_RPC_PORT; 1187 sHost.erase(iPos); 1188 } 1179 1189 lRetVal = pDoc->Connect( 1180 dlg.m_ComputerNameCtrl->GetValue(), 1190 sHost, 1191 (int)lPort, 1181 1192 dlg.m_ComputerPasswordCtrl->GetValue(), 1182 1193 TRUE, 1183 1194 FALSE -
clientgui/MainDocument.h
58 58 int GetConnectingComputerName(wxString& strMachine); 59 59 bool IsComputerNameLocal(const wxString& strMachine); 60 60 void GetLocalPassword(wxString& strPassword); 61 int SetComputer(const wxChar* szComputer, const wxChar* szPassword, const bool bUseDefaultPassword);61 int SetComputer(const wxChar* szComputer, const int iPort, const wxChar* szPassword, const bool bUseDefaultPassword); 62 62 void SetStateError(); 63 63 void SetStateErrorAuthentication(); 64 64 void SetStateReconnecting(); … … 84 84 wxString m_strConnectedComputerName; 85 85 wxString m_strConnectedComputerPassword; 86 86 wxString m_strConnectedComputerVersion; 87 int m_iPort; 87 88 }; 88 89 89 90 … … 116 117 117 118 int Connect( 118 119 const wxChar* szComputer, 120 const int iPort, 119 121 const wxChar* szComputerPassword = wxEmptyString, 120 122 const bool bDisconnect = FALSE, 121 123 const bool bUseDefaultPassword = FALSE -
clientgui/MainDocument.cpp
58 58 m_bReconnectOnError = false; 59 59 m_bNewConnection = false; 60 60 m_bUsedDefaultPassword = false; 61 m_iPort = GUI_RPC_PORT; 61 62 } 62 63 63 64 … … 151 152 // timeout event right after boot-up. 152 153 // 153 154 if (IsComputerNameLocal(strComputer)) { 154 retval = m_pDocument->rpc.init_asynch(NULL, 60.0, true );155 retval = m_pDocument->rpc.init_asynch(NULL, 60.0, true, m_iPort); 155 156 } else { 156 retval = m_pDocument->rpc.init_asynch(strComputer.mb_str(), 60.0, false );157 retval = m_pDocument->rpc.init_asynch(strComputer.mb_str(), 60.0, false, m_iPort); 157 158 } 158 159 159 160 if (!retval) { … … 206 207 } 207 208 208 209 209 int CNetworkConnection::SetComputer(const wxChar* szComputer, const wxChar* szPassword, const bool bUseDefaultPassword) {210 int CNetworkConnection::SetComputer(const wxChar* szComputer, const int iPort, const wxChar* szPassword, const bool bUseDefaultPassword) { 210 211 m_strNewComputerName.Empty(); 211 212 m_strNewComputerPassword.Empty(); 212 213 m_bUseDefaultPassword = FALSE; 213 214 214 215 m_bNewConnection = true; 215 216 m_strNewComputerName = szComputer; 217 m_iPort = iPort; 216 218 m_strNewComputerPassword = szPassword; 217 219 m_bUseDefaultPassword = bUseDefaultPassword; 218 220 return 0; … … 441 443 } 442 444 443 445 444 int CMainDocument::Connect(const wxChar* szComputer, const wxChar* szComputerPassword, const bool bDisconnect, const bool bUseDefaultPassword) {446 int CMainDocument::Connect(const wxChar* szComputer, int iPort, const wxChar* szComputerPassword, const bool bDisconnect, const bool bUseDefaultPassword) { 445 447 if (bDisconnect) { 446 448 m_pNetworkConnection->ForceReconnect(); 447 449 } 448 450 449 m_pNetworkConnection->SetComputer(szComputer, szComputerPassword, bUseDefaultPassword);451 m_pNetworkConnection->SetComputer(szComputer, iPort, szComputerPassword, bUseDefaultPassword); 450 452 m_pNetworkConnection->FireReconnectEvent(); 451 453 return 0; 452 454 } -
clientgui/BOINCBaseFrame.cpp
184 184 wxASSERT(wxDynamicCast(pDoc, CMainDocument)); 185 185 186 186 if (!pDoc->IsConnected()) { 187 pDoc->Connect(wxT("localhost"), wxEmptyString, TRUE, TRUE);187 pDoc->Connect(wxT("localhost"), GUI_RPC_PORT, wxEmptyString, TRUE, TRUE); 188 188 } 189 189 190 190 wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnInitialized - Function End")); -
lib/gui_rpc_client.C
109 109 return 0; 110 110 } 111 111 112 int RPC_CLIENT::init_asynch(const char* host, double _timeout, bool _retry ) {112 int RPC_CLIENT::init_asynch(const char* host, double _timeout, bool _retry, int port) { 113 113 int retval; 114 114 memset(&addr, 0, sizeof(addr)); 115 115 addr.sin_family = AF_INET; 116 addr.sin_port = htons( GUI_RPC_PORT);116 addr.sin_port = htons(port); 117 117 retry = _retry; 118 118 timeout = _timeout; 119 119 -
lib/gui_rpc_client.h
536 536 RPC_CLIENT(); 537 537 ~RPC_CLIENT(); 538 538 int init(const char* host, int port=0); 539 int init_asynch(const char* host, double timeout, bool retry );539 int init_asynch(const char* host, double timeout, bool retry, int port=GUI_RPC_PORT); 540 540 // timeout == how long to wait until give up 541 541 // If the caller (i.e. BOINC Manager) just launched the core client, 542 542 // this should be large enough to allow the process to