Group request manager files into their own directory

This commit is contained in:
Tamás Bálint Misius 2023-01-27 18:09:56 +01:00
parent b9c8817386
commit bd667dddad
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
10 changed files with 26 additions and 22 deletions

View File

@ -6,7 +6,7 @@
#include "client/GameSave.h"
#include "client/SaveFile.h"
#include "client/SaveInfo.h"
#include "client/http/RequestManager.h"
#include "client/http/requestmanager/RequestManager.h"
#include "common/platform/Platform.h"
#include "graphics/Graphics.h"
#include "simulation/SaveRenderer.h"

View File

@ -1,5 +1,5 @@
#include "Request.h"
#include "RequestManager.h"
#include "requestmanager/RequestManager.h"
#include <memory>
namespace http

View File

@ -5,12 +5,6 @@ client_files += files(
'Request.cpp',
'SaveUserInfoRequest.cpp',
'ThumbnailRequest.cpp',
'RequestManager.cpp',
)
if enable_http
client_files += files('RequestManagerHttp.cpp')
else
client_files += files('RequestManagerNoHttp.cpp')
endif
conf_data.set('NOHTTP', not enable_http ? 'true' : 'false')
subdir('requestmanager')

View File

@ -1,5 +1,5 @@
#include "RequestManager.h"
#include "Request.h"
#include "client/http/Request.h"
#include "Config.h"
#include <iostream>

View File

@ -1,6 +1,6 @@
#include <curl/curl.h> // Has to come first because windows(tm).
#include "RequestManager.h"
#include "Request.h"
#include "client/http/Request.h"
#include "CurlError.h"
#include "Config.h"
@ -92,7 +92,7 @@ namespace http
return std::make_shared<RequestHandleHttp>();
}
struct RequestManagerHttp : public RequestManager
struct RequestManagerImpl : public RequestManager
{
using RequestManager::RequestManager;
@ -102,7 +102,7 @@ namespace http
void RequestManager::InitWorker()
{
auto manager = static_cast<RequestManagerHttp *>(this);
auto manager = static_cast<RequestManagerImpl *>(this);
if (!curl_global_init(CURL_GLOBAL_DEFAULT))
{
manager->curlGlobalInit = true;
@ -119,7 +119,7 @@ namespace http
void RequestManager::ExitWorker()
{
auto manager = static_cast<RequestManagerHttp *>(this);
auto manager = static_cast<RequestManagerImpl *>(this);
curl_multi_cleanup(manager->curlMulti);
manager->curlMulti = NULL;
curl_global_cleanup();
@ -127,7 +127,7 @@ namespace http
void RequestManager::RegisterRequestHandle(std::shared_ptr<RequestHandle> requestHandle)
{
auto manager = static_cast<RequestManagerHttp *>(this);
auto manager = static_cast<RequestManagerImpl *>(this);
auto handle = static_cast<RequestHandleHttp *>(requestHandle.get());
auto failEarly = [&requestHandle](int statusCode, ByteString error) {
requestHandle->statusCode = statusCode;
@ -288,7 +288,7 @@ namespace http
void RequestManager::UnregisterRequestHandle(std::shared_ptr<RequestHandle> requestHandle)
{
auto manager = static_cast<RequestManagerHttp *>(this);
auto manager = static_cast<RequestManagerImpl *>(this);
auto handle = static_cast<RequestHandleHttp *>(requestHandle.get());
if (handle->curlAddedToMulti)
{
@ -311,7 +311,7 @@ namespace http
std::this_thread::sleep_for(std::chrono::milliseconds(TickMs));
return;
}
auto manager = static_cast<RequestManagerHttp *>(this);
auto manager = static_cast<RequestManagerImpl *>(this);
int dontcare;
HandleCURLMcode(curl_multi_wait(manager->curlMulti, NULL, 0, TickMs, &dontcare));
HandleCURLMcode(curl_multi_perform(manager->curlMulti, &dontcare));
@ -391,12 +391,12 @@ namespace http
RequestManagerPtr RequestManager::Create(ByteString newProxy, ByteString newCafile, ByteString newCapath, bool newDisableNetwork)
{
return RequestManagerPtr(new RequestManagerHttp(newProxy, newCafile, newCapath, newDisableNetwork));
return RequestManagerPtr(new RequestManagerImpl(newProxy, newCafile, newCapath, newDisableNetwork));
}
void RequestManagerDeleter::operator ()(RequestManager *ptr) const
{
delete static_cast<RequestManagerHttp *>(ptr);
delete static_cast<RequestManagerImpl *>(ptr);
}
void SetupCurlEasyCiphers(CURL *easy)

View File

@ -1,5 +1,5 @@
#include "RequestManager.h"
#include "Request.h"
#include "client/http/Request.h"
namespace http
{

View File

@ -0,0 +1,10 @@
client_files += files(
'Common.cpp',
)
if enable_http
client_files += files('Libcurl.cpp')
else
client_files += files('Null.cpp')
endif
conf_data.set('NOHTTP', not enable_http ? 'true' : 'false')

View File

@ -9,8 +9,8 @@
#include <algorithm>
#include "LuaScriptInterface.h"
#include "client/http/RequestManager.h"
#include "client/http/CurlError.h"
#include "client/http/requestmanager/RequestManager.h"
#include "client/http/requestmanager/CurlError.h"
#include "Misc.h"
namespace LuaSocket