feat(Core/Network): Add Proxy Protocol v2 support. (#18839)

* feat(Core/Network): Add Proxy Protocol v2 support.

* Fix codestyle and build.

* Another codestyle fix.

* One more missing include.
This commit is contained in:
Anton Popovichenko
2024-05-04 18:38:32 +02:00
committed by GitHub
parent 715b290cb7
commit 9815025341
7 changed files with 247 additions and 12 deletions

View File

@@ -20,6 +20,7 @@
#include "AuthSession.h"
#include "SocketMgr.h"
#include "Config.h"
class AuthSocketMgr : public SocketMgr<AuthSession>
{
@@ -44,7 +45,13 @@ public:
protected:
NetworkThread<AuthSession>* CreateThreads() const override
{
return new NetworkThread<AuthSession>[1];
NetworkThread<AuthSession>* threads = new NetworkThread<AuthSession>[1];
bool proxyProtocolEnabled = sConfigMgr->GetOption<bool>("EnableProxyProtocol", false, true);
if (proxyProtocolEnabled)
threads[0].EnableProxyProtocol();
return threads;
}
static void OnSocketAccept(tcp::socket&& sock, uint32 threadIndex)