Ticket #56: gui_port.patch

File gui_port.patch, 6.6 kB (added by Der Meister, 10 months ago)

Patch implementing this feature request.

  • clientgui/AdvancedFrame.cpp

    old new  
    11701170        if (wxEmptyString == dlg.m_ComputerNameCtrl->GetValue()) { 
    11711171            lRetVal = pDoc->Connect( 
    11721172                wxT("localhost"), 
     1173                GUI_RPC_PORT, 
    11731174                wxEmptyString, 
    11741175                TRUE, 
    11751176                TRUE 
    11761177            ); 
    11771178        } else { 
    11781179            // 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            } 
    11791189            lRetVal = pDoc->Connect( 
    1180                 dlg.m_ComputerNameCtrl->GetValue(),  
     1190                sHost, 
     1191                (int)lPort, 
    11811192                dlg.m_ComputerPasswordCtrl->GetValue(), 
    11821193                TRUE, 
    11831194                FALSE 
  • clientgui/MainDocument.h

    old new  
    5858    int            GetConnectingComputerName(wxString& strMachine); 
    5959    bool           IsComputerNameLocal(const wxString& strMachine); 
    6060    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); 
    6262    void           SetStateError(); 
    6363    void           SetStateErrorAuthentication(); 
    6464    void           SetStateReconnecting(); 
     
    8484    wxString       m_strConnectedComputerName; 
    8585    wxString       m_strConnectedComputerPassword; 
    8686    wxString       m_strConnectedComputerVersion; 
     87    int            m_iPort; 
    8788}; 
    8889 
    8990 
     
    116117 
    117118    int                         Connect( 
    118119                                    const wxChar* szComputer, 
     120                                    const int iPort, 
    119121                                    const wxChar* szComputerPassword = wxEmptyString, 
    120122                                    const bool bDisconnect = FALSE, 
    121123                                    const bool bUseDefaultPassword = FALSE 
  • clientgui/MainDocument.cpp

    old new  
    5858    m_bReconnectOnError = false; 
    5959    m_bNewConnection = false; 
    6060    m_bUsedDefaultPassword = false; 
     61    m_iPort = GUI_RPC_PORT; 
    6162} 
    6263 
    6364 
     
    151152            //   timeout event right after boot-up. 
    152153            // 
    153154            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); 
    155156            } 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); 
    157158            } 
    158159 
    159160            if (!retval) { 
     
    206207} 
    207208 
    208209 
    209 int CNetworkConnection::SetComputer(const wxChar* szComputer, const wxChar* szPassword,  const bool bUseDefaultPassword) { 
     210int CNetworkConnection::SetComputer(const wxChar* szComputer, const int iPort, const wxChar* szPassword,  const bool bUseDefaultPassword) { 
    210211    m_strNewComputerName.Empty(); 
    211212    m_strNewComputerPassword.Empty(); 
    212213    m_bUseDefaultPassword = FALSE; 
    213214 
    214215    m_bNewConnection = true; 
    215216    m_strNewComputerName = szComputer; 
     217    m_iPort = iPort; 
    216218    m_strNewComputerPassword = szPassword; 
    217219    m_bUseDefaultPassword = bUseDefaultPassword; 
    218220    return 0; 
     
    441443} 
    442444 
    443445 
    444 int CMainDocument::Connect(const wxChar* szComputer, const wxChar* szComputerPassword, const bool bDisconnect, const bool bUseDefaultPassword) { 
     446int CMainDocument::Connect(const wxChar* szComputer, int iPort, const wxChar* szComputerPassword, const bool bDisconnect, const bool bUseDefaultPassword) { 
    445447    if (bDisconnect) { 
    446448        m_pNetworkConnection->ForceReconnect(); 
    447449    } 
    448450 
    449     m_pNetworkConnection->SetComputer(szComputer, szComputerPassword, bUseDefaultPassword); 
     451    m_pNetworkConnection->SetComputer(szComputer, iPort, szComputerPassword, bUseDefaultPassword); 
    450452    m_pNetworkConnection->FireReconnectEvent(); 
    451453    return 0; 
    452454} 
  • clientgui/BOINCBaseFrame.cpp

    old new  
    184184    wxASSERT(wxDynamicCast(pDoc, CMainDocument)); 
    185185 
    186186    if (!pDoc->IsConnected()) { 
    187         pDoc->Connect(wxT("localhost"), wxEmptyString, TRUE, TRUE); 
     187        pDoc->Connect(wxT("localhost"), GUI_RPC_PORT, wxEmptyString, TRUE, TRUE); 
    188188    } 
    189189 
    190190    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnInitialized - Function End")); 
  • lib/gui_rpc_client.C

    old new  
    109109    return 0; 
    110110} 
    111111 
    112 int RPC_CLIENT::init_asynch(const char* host, double _timeout, bool _retry) { 
     112int RPC_CLIENT::init_asynch(const char* host, double _timeout, bool _retry, int port) { 
    113113    int retval; 
    114114        memset(&addr, 0, sizeof(addr)); 
    115115    addr.sin_family = AF_INET; 
    116     addr.sin_port = htons(GUI_RPC_PORT); 
     116    addr.sin_port = htons(port); 
    117117    retry = _retry; 
    118118    timeout = _timeout; 
    119119 
  • lib/gui_rpc_client.h

    old new  
    536536    RPC_CLIENT(); 
    537537    ~RPC_CLIENT(); 
    538538    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); 
    540540        // timeout == how long to wait until give up 
    541541        //    If the caller (i.e. BOINC Manager) just launched the core client, 
    542542        //    this should be large enough to allow the process to 

If this page is incomplete or incorrect, please edit it or add it to the wiki to-do list. To do this, you must be logged in; click Login or Register above.