int32_t CSSLClientAsync::ReConnectAsync()
{
    int32_t nErrorCode = 0;
    if (S_INVALID_SOCKET == GetSocket())
    {
        _InitSocket();
        InitSSL(GetCertFile().c_str(), GetKeyFile().c_str(), GetKeyPassword().c_str());
        nErrorCode = ConnectAsync(GetRemoteIP(), GetRemotePort());
    }
    return nErrorCode;
}
Example #2
0
BOOL CAPNSClient::ConnectFeedback()
{
    BOOL bRet = FALSE;
    m_pFeedbackClient->DoConnect.connect(&m_feedbackhandler, &CAPNSFeedBackHandler::OnConnect);
    m_pFeedbackClient->DoClose.connect(&m_feedbackhandler, &CAPNSFeedBackHandler::OnClose);
    m_pFeedbackClient->DoException.connect(&m_feedbackhandler, &CAPNSFeedBackHandler::OnException);
    m_pFeedbackClient->DoRecv.connect((CBaseHandler*)&m_feedbackhandler, &CAPNSFeedBackHandler::OnRecv);
    m_pFeedbackClient->DoSSLConnect.connect(&m_feedbackhandler, &CAPNSFeedBackHandler::OnSSLConnect);
    
    if (m_pFeedbackClient->InitSSL(GetCertPath().c_str(), GetKeyPath().c_str(), GetKeyPassword().c_str()) == FALSE)
    {
        PUSH_SERVER_ERROR("feedback client init ssl failed.");
        return bRet;
    }
    
    if (_GetAPNSServerAddress())
    {
        m_pFeedbackClient->ConnectAsync(GetFeedbackIP().c_str(), GetFeedbackPort());
        bRet = TRUE;
    }
    return bRet;
}