Skip to content

Commit 6266009

Browse files
committed
- Log which HTTP protocol we are using to communicate with GO services
1 parent 6d3f224 commit 6266009

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameNetwork/GeneralsOnline/HTTP/HTTPManager.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ class HTTPManager
4747
return m_bCACertBad.load();
4848
}
4949

50+
void SetProtocolInUse(EIPProtocolVersion proto)
51+
{
52+
m_sProtocolInUse.store(proto);
53+
}
54+
55+
EIPProtocolVersion GetProtocolInUse()
56+
{
57+
return m_sProtocolInUse.load();
58+
}
59+
5060
void AddHandleToMulti(CURL* pNewHandle);
5161
void RemoveHandleFromMulti(CURL* pHandleToRemove);
5262

@@ -71,6 +81,8 @@ class HTTPManager
7181
private:
7282
CURLM* m_pCurl = nullptr;
7383

84+
std::atomic<EIPProtocolVersion> m_sProtocolInUse = EIPProtocolVersion::DONT_CARE;
85+
7486
static std::atomic<bool> m_bCACertBad;
7587

7688
bool m_bProxyEnabled = false;

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/HTTP/HTTPRequest.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,41 @@ bool HTTPRequest::InvokeDelayAction()
150150

151151
void HTTPRequest::Threaded_SetComplete(CURLcode result)
152152
{
153-
if (result == CURLE_SSL_CACERT_BADFILE || CURLE_PEER_FAILED_VERIFICATION)
153+
if (result == CURLE_SSL_CACERT_BADFILE || result == CURLE_PEER_FAILED_VERIFICATION)
154154
{
155155
HTTPManager::SetCACertStoreBad();
156156
}
157157
// store response code
158158
curl_easy_getinfo(m_pCURL, CURLINFO_RESPONSE_CODE, &m_responseCode);
159159

160+
if (result == CURLE_OK)
161+
{
162+
HTTPManager* pHTTPManager = static_cast<HTTPManager*>(NGMP_OnlineServicesManager::GetInstance()->GetHTTPManager());
163+
if (pHTTPManager != nullptr)
164+
{
165+
if (pHTTPManager->GetProtocolInUse() == EIPProtocolVersion::DONT_CARE)
166+
{
167+
char* ip = nullptr;
168+
curl_easy_getinfo(m_pCURL, CURLINFO_PRIMARY_IP, &ip);
169+
170+
if (ip)
171+
{
172+
std::string addr(ip);
173+
if (addr.find(':') != std::string::npos)
174+
{
175+
pHTTPManager->SetProtocolInUse(EIPProtocolVersion::FORCE_IPV6);
176+
NetworkLog(ELogVerbosity::LOG_RELEASE, "[HTTP] We are connected to GO services using IPv6");
177+
}
178+
else
179+
{
180+
pHTTPManager->SetProtocolInUse(EIPProtocolVersion::FORCE_IPV4);
181+
NetworkLog(ELogVerbosity::LOG_RELEASE, "[HTTP] We are connected to GO services using IPv4");
182+
}
183+
}
184+
}
185+
}
186+
}
187+
160188
m_bIsComplete = true;
161189

162190
// finalize the size, so we can use .size etc

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/OnlineServices_Init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ void NGMP_OnlineServicesManager::InitSentry()
998998

999999
sentry_options_set_dsn(options, "https://61750bebd112d279bcc286d617819269@o4509316925554688.ingest.us.sentry.io/4509316927586304");
10001000
sentry_options_set_database_path(options, strDumpPath.c_str());
1001-
sentry_options_set_release(options, "generalsonline-client@032926_QFE3");
1001+
sentry_options_set_release(options, "generalsonline-client@032926_QFE5");
10021002

10031003
#if defined(USE_TEST_ENV)
10041004
sentry_options_set_environment(options, "test");

0 commit comments

Comments
 (0)