Skip to content

Commit 412bdc7

Browse files
committed
- Remove ServiceCountryConfig to match service-side changes
1 parent fa74ece commit 412bdc7

7 files changed

Lines changed: 15 additions & 68 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class HTTPManager
3939
void AddHandleToMulti(CURL* pNewHandle);
4040
void RemoveHandleFromMulti(CURL* pHandleToRemove);
4141

42-
void SendGETRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1, bool bApplyRestrictiveCountryOverride = false);
43-
void SendPOSTRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, const char* szPostData, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1, bool bApplyRestrictiveCountryOverride = false);
42+
void SendGETRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1);
43+
void SendPOSTRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, const char* szPostData, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1);
4444
void SendPUTRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, const char* szData, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1);
4545
void SendDELETERequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, const char* szData, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1);
4646

@@ -54,7 +54,7 @@ class HTTPManager
5454

5555
private:
5656
HTTPRequest* PlatformCreateRequest(EHTTPVerb htpVerb, EIPProtocolVersion protover, const char* szURI, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback,
57-
std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1, bool bApplyRestrictiveCountryOverride = false) noexcept;
57+
std::function<void(size_t bytesReceived)> progressCallback = nullptr, int timeoutMS = -1) noexcept;
5858

5959
private:
6060
CURLM* m_pCurl = nullptr;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class HTTPRequest
1212
{
1313
public:
1414
HTTPRequest(EHTTPVerb httpVerb, EIPProtocolVersion protover, const char* szURI, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)>
15-
progressCallback = nullptr, int timeout = -1, bool bApplyRestrictiveCountryOverride = false) noexcept;
15+
progressCallback = nullptr, int timeout = -1) noexcept;
1616
~HTTPRequest();
1717

1818
bool EasyHandleMatches(CURL* pHandle)
@@ -91,7 +91,6 @@ class HTTPRequest
9191
bool m_bNeedsProgressUpdate = false;
9292
bool m_bIsStarted = false;
9393
bool m_bIsComplete = false;
94-
bool m_bApplyRestrictiveCountryOverride = false;
9594

9695
struct curl_slist* headers = nullptr;
9796

GeneralsMD/Code/GameEngine/Include/GameNetwork/GeneralsOnline/OnlineServices_Init.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,6 @@ struct ServiceConfig
282282
use_default_config, ra_slack_override_percent_in_default, do_probes, do_replay_upload)
283283
};
284284

285-
struct ServiceCountryConfig
286-
{
287-
bool apply_restrictive_country_tls_settings = false;
288-
289-
NLOHMANN_DEFINE_TYPE_INTRUSIVE(ServiceCountryConfig, apply_restrictive_country_tls_settings)
290-
};
291-
292285
class NGMP_OnlineServicesManager
293286
{
294287
private:
@@ -402,7 +395,6 @@ class NGMP_OnlineServicesManager
402395
void WaitForScreenshotThreads();
403396

404397
void GetAndParseServiceConfig(std::function<void(void)> cbOnDone);
405-
void GetAndParseServiceCountryConfig(std::function<void(void)> cbOnDone);
406398

407399
~NGMP_OnlineServicesManager()
408400
{
@@ -504,7 +496,6 @@ class NGMP_OnlineServicesManager
504496
NGMP_OnlineServices_MatchmakingInterface* m_pMatchmakingInterface = nullptr;
505497

506498
ServiceConfig& GetServiceConfig() { return m_ServiceConfig; }
507-
ServiceCountryConfig& GetServiceCountryConfig() { return m_ServiceCountryConfig; }
508499

509500
private:
510501
// main thread SS Upload
@@ -516,7 +507,6 @@ class NGMP_OnlineServicesManager
516507
std::mutex m_mutexScreenshotThreads;
517508

518509
ServiceConfig m_ServiceConfig;
519-
ServiceCountryConfig m_ServiceCountryConfig;
520510

521511
HTTPManager* m_pHTTPManager = nullptr;
522512

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,9 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData )
463463
return;
464464
}
465465

466-
// get country config first, we need it before we can do anything else
467-
NGMP_OnlineServicesManager::GetInstance()->GetAndParseServiceCountryConfig([=]()
468-
{
469-
// Now we can begin login
470-
pAuthInterface->RegisterForLoginCallback(NGMP_WOLLoginMenu_LoginCallback);
471-
pAuthInterface->BeginLogin();
472-
});
466+
// Now we can begin login
467+
pAuthInterface->RegisterForLoginCallback(NGMP_WOLLoginMenu_LoginCallback);
468+
pAuthInterface->BeginLogin();
473469

474470

475471
/*

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ HTTPManager::HTTPManager() noexcept
77

88
}
99

10-
void HTTPManager::SendGETRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback, int timeoutMS, bool bApplyRestrictiveCountryOverride)
10+
void HTTPManager::SendGETRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback, int timeoutMS)
1111
{
1212
CHECK_MAIN_THREAD;
1313

14-
HTTPRequest* pRequest = PlatformCreateRequest(EHTTPVerb::HTTP_VERB_GET, protover, szURI, inHeaders, completionCallback, progressCallback, timeoutMS, bApplyRestrictiveCountryOverride);
14+
HTTPRequest* pRequest = PlatformCreateRequest(EHTTPVerb::HTTP_VERB_GET, protover, szURI, inHeaders, completionCallback, progressCallback, timeoutMS);
1515

1616
m_vecRequestsPendingStart.push_back(pRequest);
1717
}
1818

19-
void HTTPManager::SendPOSTRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, const char* szPostData, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback, int timeoutMS, bool bApplyRestrictiveCountryOverride)
19+
void HTTPManager::SendPOSTRequest(const char* szURI, EIPProtocolVersion protover, std::map<std::string, std::string>& inHeaders, const char* szPostData, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback, int timeoutMS)
2020
{
2121
CHECK_MAIN_THREAD;
2222

23-
HTTPRequest* pRequest = PlatformCreateRequest(EHTTPVerb::HTTP_VERB_POST, protover, szURI, inHeaders, completionCallback, progressCallback, timeoutMS, bApplyRestrictiveCountryOverride);
23+
HTTPRequest* pRequest = PlatformCreateRequest(EHTTPVerb::HTTP_VERB_POST, protover, szURI, inHeaders, completionCallback, progressCallback, timeoutMS);
2424
pRequest->SetPostData(szPostData);
2525

2626
m_vecRequestsPendingStart.push_back(pRequest);
@@ -150,11 +150,11 @@ bool HTTPManager::DeterminePlatformProxySettings()
150150
return m_bProxyEnabled;
151151
}
152152

153-
HTTPRequest* HTTPManager::PlatformCreateRequest(EHTTPVerb httpVerb, EIPProtocolVersion protover, const char* szURI, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback /*= nullptr*/, int timeoutMS /* = -1 */, bool bApplyRestrictiveCountryOverride /*= false*/) noexcept
153+
HTTPRequest* HTTPManager::PlatformCreateRequest(EHTTPVerb httpVerb, EIPProtocolVersion protover, const char* szURI, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback, std::function<void(size_t bytesReceived)> progressCallback /*= nullptr*/, int timeoutMS /* = -1 */) noexcept
154154
{
155155
CHECK_MAIN_THREAD;
156156

157-
HTTPRequest* pNewRequest = new HTTPRequest(httpVerb, protover, szURI, inHeaders, completionCallback, progressCallback, timeoutMS, bApplyRestrictiveCountryOverride);
157+
HTTPRequest* pNewRequest = new HTTPRequest(httpVerb, protover, szURI, inHeaders, completionCallback, progressCallback, timeoutMS);
158158
return pNewRequest;
159159
}
160160

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ size_t WriteMemoryCallback(void* contents, size_t sizePerByte, size_t numBytes,
1313
}
1414

1515
HTTPRequest::HTTPRequest(EHTTPVerb httpVerb, EIPProtocolVersion protover, const char* szURI, std::map<std::string, std::string>& inHeaders, std::function<void(bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)> completionCallback,
16-
std::function<void(size_t bytesReceived)> progressCallback /*= nullptr*/, int timeoutMS/*= -1*/, bool bApplyRestrictiveCountryOverride/* = false*/) noexcept
16+
std::function<void(size_t bytesReceived)> progressCallback /*= nullptr*/, int timeoutMS/*= -1*/) noexcept
1717
{
1818
m_pCURL = curl_easy_init();
1919

@@ -31,8 +31,6 @@ HTTPRequest::HTTPRequest(EHTTPVerb httpVerb, EIPProtocolVersion protover, const
3131
m_mapHeaders = inHeaders;
3232

3333
m_progressCallback = progressCallback;
34-
35-
m_bApplyRestrictiveCountryOverride = bApplyRestrictiveCountryOverride;
3634
}
3735

3836
HTTPRequest::~HTTPRequest()

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

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,6 @@ std::vector<std::string> NGMP_OnlineServicesManager::m_vecGuardedSSData;
3737

3838
bool NGMP_OnlineServicesManager::g_bAdvancedNetworkStats;
3939

40-
41-
void NGMP_OnlineServicesManager::GetAndParseServiceCountryConfig(std::function<void(void)> cbOnDone)
42-
{
43-
std::string strURI = NGMP_OnlineServicesManager::GetAPIEndpoint("ServiceCountryConfig");
44-
std::map<std::string, std::string> mapHeaders;
45-
NGMP_OnlineServicesManager::GetInstance()->GetHTTPManager()->SendGETRequest(strURI.c_str(), EIPProtocolVersion::DONT_CARE, mapHeaders, [=](bool bSuccess, int statusCode, std::string strBody, HTTPRequest* pReq)
46-
{
47-
try
48-
{
49-
if (bSuccess && statusCode == 200)
50-
{
51-
nlohmann::json jsonObject = nlohmann::json::parse(strBody);
52-
m_ServiceCountryConfig = jsonObject.get<ServiceCountryConfig>();
53-
}
54-
else
55-
{
56-
// It's OK to fail, we'll just use the sensible defaults
57-
NetworkLog(ELogVerbosity::LOG_RELEASE, "[NGMP] Failed to get service country config, using defaults. Status code: %d", statusCode);
58-
m_ServiceCountryConfig = ServiceCountryConfig();
59-
}
60-
61-
}
62-
catch (...)
63-
{
64-
// It's OK to fail, we'll just use the sensible defaults
65-
NetworkLog(ELogVerbosity::LOG_RELEASE, "[NGMP] Failed to get service country config, using defaults. Exception.");
66-
m_ServiceCountryConfig = ServiceCountryConfig();
67-
}
68-
69-
if (cbOnDone != nullptr)
70-
{
71-
cbOnDone();
72-
}
73-
}, nullptr, -1, true); // NOTE: First call to determine the country config must use settings that supports restrictive countries
74-
}
75-
7640
NetworkMesh* NGMP_OnlineServicesManager::GetNetworkMesh()
7741
{
7842
if (m_pOnlineServicesManager != nullptr)
@@ -397,7 +361,7 @@ void NGMP_OnlineServicesManager::StartVersionCheck(std::function<void(bool bSucc
397361
NetworkLog(ELogVerbosity::LOG_RELEASE, "VERSION CHECK: Failed to parse response");
398362
fnCallback(false, false);
399363
}
400-
}, nullptr, -1, true);
364+
}, nullptr, -1);
401365
}
402366

403367
void NGMP_OnlineServicesManager::ContinueUpdate()

0 commit comments

Comments
 (0)