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

@@ -114,5 +114,13 @@ void WorldSocketMgr::OnSocketOpen(tcp::socket&& sock, uint32 threadIndex)
NetworkThread<WorldSocket>* WorldSocketMgr::CreateThreads() const
{
return new WorldSocketThread[GetNetworkThreadCount()];
NetworkThread<WorldSocket>* threads = new WorldSocketThread[GetNetworkThreadCount()];
bool proxyProtocolEnabled = sConfigMgr->GetOption<bool>("Network.EnableProxyProtocol", false, true);
if (proxyProtocolEnabled)
for (int i = 0; i < GetNetworkThreadCount(); i++)
threads[i].EnableProxyProtocol();
return threads;
}