Skip to content
Permalink
Browse files

Test to fix some connect timeouts #2

  • Loading branch information...
ccw808 committed Jul 13, 2015
1 parent f394dc7 commit 89b1bbb3e43eaa1e9742dead1bd332ba2efd99cb
Showing with 13 additions and 3 deletions.
  1. +12 −3 MTA10/core/CConnectManager.cpp
  2. +1 −0 MTA10/core/CConnectManager.h
@@ -116,9 +116,6 @@ bool CConnectManager::Connect ( const char* szHost, unsigned short usPort, const
if ( !CCore::GetSingleton ().CheckDiskSpace () )
return false;

// Test: Fix some timeouts by trying a tcp connection
pNet->GetHTTPDownloadManager ( EDownloadMode::CORE_UPDATER )->QueueFile ( m_strHost.c_str(), NULL, 0, "", 0, true, NULL, NULL, false, 1, 2000 );

// Set our packet handler
pNet->RegisterPacketHandler ( CConnectManager::StaticProcessPacket );

@@ -133,6 +130,7 @@ bool CConnectManager::Connect ( const char* szHost, unsigned short usPort, const

m_bIsConnecting = true;
m_tConnectStarted = time ( NULL );
m_bHasSentTcpRequest = false;

// Load server password
if ( m_strPassword.empty () )
@@ -250,6 +248,17 @@ void CConnectManager::DoPulse ( void )
}
}

if ( !m_bHasSentTcpRequest )
{
if ( time ( NULL ) >= m_tConnectStarted + 2 )
{
// Handle possible IP rejection by proving we exist with a TCP connection
g_pCore->GetNetwork()->GetHTTPDownloadManager( EDownloadMode::CORE_UPDATER )->QueueFile( m_strHost.c_str(), NULL, 0, "", 0, true, NULL, NULL, false, 1, 2000 );
m_bHasSentTcpRequest = true;
AddReportLog( 9401, SString( "ConnectManager sent TCP connection request to %s", m_strHost.c_str() ) );
}
}

// Time to timeout the connection?
if ( time ( NULL ) >= m_tConnectStarted + 8 )
{
@@ -55,6 +55,7 @@ class CConnectManager
bool m_bSave;
bool m_bForceInternalHTTPServer;
time_t m_tConnectStarted;
bool m_bHasSentTcpRequest;

GUI_CALLBACK* m_pOnCancelClick;

0 comments on commit 89b1bbb

Please sign in to comment.
You can’t perform that action at this time.