24#include <boost/system/error_code.hpp>
29 void SocketAdded(std::shared_ptr<WorldSocket>
const& sock)
override
31 sock->SetSendBufferSize(
sWorldSocketMgr.GetApplicationSendBufferSize());
56 TC_LOG_DEBUG(
"misc",
"Max allowed socket connections {}", max_connections);
65 TC_LOG_ERROR(
"misc",
"Network.OutUBuff is wrong in your config file");
69 if (!BaseSocketMgr::StartNetwork(ioContext, bindIp, port, threadCount))
83 BaseSocketMgr::StopNetwork();
93 boost::system::error_code err;
95 if (err && err != boost::system::errc::not_supported)
97 TC_LOG_ERROR(
"misc",
"WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::socket_base::send_buffer_size) err = {}", err.message());
105 boost::system::error_code err;
106 sock.set_option(boost::asio::ip::tcp::no_delay(
true), err);
109 TC_LOG_ERROR(
"misc",
"WorldSocketMgr::OnSocketOpen sock.set_option(boost::asio::ip::tcp::no_delay) err = {}", err.message());
116 BaseSocketMgr::OnSocketOpen(std::move(sock), threadIndex);
#define TRINITY_MAX_LISTEN_CONNECTIONS
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
int32 GetNetworkThreadCount() const
std::unique_ptr< AsyncAcceptor > _acceptor
Manages all sockets connected to peers and network threads.
int32 _socketSystemSendBufferSize
void OnSocketOpen(Trinity::Net::IoContextTcpSocket &&sock, uint32 threadIndex) override
SocketMgr< WorldSocket > BaseSocketMgr
int32 _socketApplicationSendBufferSize
Trinity::Net::NetworkThread< WorldSocket > * CreateThreads() const override
static WorldSocketMgr & Instance()
bool StartWorldNetwork(Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int networkThreads)
Start network, listen at address:port .
void StopNetwork() override
Stops all network threads, It will wait for all running threads .
void SocketAdded(std::shared_ptr< WorldSocket > const &sock) override
void SocketRemoved(std::shared_ptr< WorldSocket >const &sock) override
boost::asio::basic_stream_socket< boost::asio::ip::tcp, boost::asio::io_context::executor_type > IoContextTcpSocket