예제 #1
0
void CRemoteCall::MakeCall()
{
    CNetHTTPDownloadManagerInterface * downloadManager = g_pNetServer->GetHTTPDownloadManager();
    downloadManager->QueueFile ( m_strURL, NULL, 0, m_strData.c_str (), this, ProgressCallback );
    if ( !downloadManager->IsDownloading() )
        downloadManager->StartDownloadingQueuedFiles();
}
///////////////////////////////////////////////////////////////
//
// CResourceFileDownloadManager::BeginResourceFileDownload
//
// Return false if file could not be queued
//
///////////////////////////////////////////////////////////////
bool CResourceFileDownloadManager::BeginResourceFileDownload(CDownloadableResource* pResourceFile, uint uiHttpServerIndex)
{
    if (uiHttpServerIndex >= m_HttpServerList.size())
        return false;

    // Find enabled server
    while (m_HttpServerList[uiHttpServerIndex].bEnabled == false)
    {
        uiHttpServerIndex++;
        if (uiHttpServerIndex >= m_HttpServerList.size())
            return false;
    }

    pResourceFile->SetHttpServerIndex(uiHttpServerIndex);

    const SHttpServerInfo&            serverInfo = m_HttpServerList[uiHttpServerIndex];
    CNetHTTPDownloadManagerInterface* pHTTP = g_pCore->GetNetwork()->GetHTTPDownloadManager(serverInfo.downloadChannel);
    SString strHTTPDownloadURLFull("%s/%s/%s", *serverInfo.strUrl, pResourceFile->GetResource()->GetName(), pResourceFile->GetShortName());

    SHttpRequestOptions options;
    options.uiConnectionAttempts = serverInfo.uiConnectionAttempts;
    options.uiConnectTimeoutMs = serverInfo.uiConnectTimeoutMs;
    options.bCheckContents = true;
    options.bIsLocal = g_pClientGame->IsLocalGame();
    SString* pstrContext = MakeDownloadContextString(pResourceFile);
    SString  strFilename = pResourceFile->GetName();
    bool bUniqueDownload = pHTTP->QueueFile(strHTTPDownloadURLFull, strFilename, pstrContext, StaticDownloadFinished, options);
    if (!bUniqueDownload)
    {
        // TODO - If piggybacking on another matching download, then adjust progress bar
        OutputDebugLine(SString("[ResourceFileDownload] Using existing download for %s", *strHTTPDownloadURLFull));
    }
    return true;
}
예제 #3
0
CSerialVerification::CSerialVerification ( CPlayer* pPlayer, SERIALVERIFICATIONCALLBACK pCallBack )
{
    char buf[32] = {0};
    CLogger::LogPrintf ( "VERIFY: Querying %s\n", SERIAL_VERIFICATION_SERVER );

	m_pCallBack = pCallBack;
	m_pPlayer = pPlayer;
	m_ulStartTime = GetTickCount();
	m_bFinished = false;

	if ( pPlayer->GetSerialUser().length() > 0 && pPlayer->GetSerial().length() > 0 )
	{
        // Create the POST URL
        std::string strPostData = "[\"" + pPlayer->GetSerialUser () +
                                  "\",\"" + pPlayer->GetSerial () +
                                  "\"," + itoa ( g_pGame->GetConfig ()->GetServerPort (), buf, 10 ) + "]";

        // Use CURL to perform the POST
        CNetHTTPDownloadManagerInterface * pHTTP = g_pNetServer->GetHTTPDownloadManager ();
		pHTTP->QueueFile ( SERIAL_VERIFICATION_URL, NULL, 0, strPostData.c_str (), this, ProgressCallback );
		if ( !pHTTP->IsDownloading () )
			pHTTP->StartDownloadingQueuedFiles ();
	}
	else
	{
		m_pCallBack ( m_pPlayer, false, szSerialErrorMessages[SERIAL_ERROR_INVALID_ACCOUNT] );
		m_bFinished = true;
	}
}
예제 #4
0
void CRemoteCall::MakeCall()
{
    // Bypass net module IP check if we are allowed to access the URL
    bool bAnyHost = (g_pCore->GetWebCore()->GetDomainState(g_pCore->GetWebCore()->GetDomainFromURL(m_strURL)) == eURLState::WEBPAGE_ALLOWED);
    EDownloadModeType downloadMode = g_pClientGame->GetRemoteCalls()->GetDownloadModeForQueueName(m_strQueueName, bAnyHost);
    CNetHTTPDownloadManagerInterface* pDownloadManager = g_pNet->GetHTTPDownloadManager(downloadMode);
    pDownloadManager->QueueFile(m_strURL, NULL, this, DownloadFinishedCallback, false, m_options, false, false);
}
예제 #5
0
void CRemoteCall::MakeCall()
{
    CNetHTTPDownloadManagerInterface * downloadManager = g_pNetServer->GetHTTPDownloadManager ( EDownloadMode::CALL_REMOTE );
    downloadManager->QueueFile ( m_strURL, NULL, 0, m_strData.c_str (), m_strData.length (), m_bPostBinary, this, ProgressCallback, false, m_uiConnectionAttempts, m_uiConnectTimeoutMs );
}