mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
chore(Core/Shared): little cleanup (#18385)
This commit is contained in:
@@ -27,11 +27,7 @@
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
|
||||
#if BOOST_VERSION >= 106600
|
||||
#define ACORE_MAX_LISTEN_CONNECTIONS boost::asio::socket_base::max_listen_connections
|
||||
#else
|
||||
#define ACORE_MAX_LISTEN_CONNECTIONS boost::asio::socket_base::max_connections
|
||||
#endif
|
||||
constexpr auto ACORE_MAX_LISTEN_CONNECTIONS = boost::asio::socket_base::max_listen_connections;
|
||||
|
||||
class AsyncAcceptor
|
||||
{
|
||||
@@ -40,7 +36,7 @@ public:
|
||||
|
||||
AsyncAcceptor(Acore::Asio::IoContext& ioContext, std::string const& bindIp, uint16 port) :
|
||||
_acceptor(ioContext), _endpoint(Acore::Net::make_address(bindIp), port),
|
||||
_socket(ioContext), _closed(false), _socketFactory(std::bind(&AsyncAcceptor::DefeaultSocketFactory, this))
|
||||
_socket(ioContext), _closed(false), _socketFactory([this](){ return DefaultSocketFactory(); })
|
||||
{
|
||||
}
|
||||
|
||||
@@ -122,7 +118,7 @@ public:
|
||||
void SetSocketFactory(std::function<std::pair<tcp::socket*, uint32>()> func) { _socketFactory = func; }
|
||||
|
||||
private:
|
||||
std::pair<tcp::socket*, uint32> DefeaultSocketFactory() { return std::make_pair(&_socket, 0); }
|
||||
std::pair<tcp::socket*, uint32> DefaultSocketFactory() { return std::make_pair(&_socket, 0); }
|
||||
|
||||
tcp::acceptor _acceptor;
|
||||
tcp::endpoint _endpoint;
|
||||
@@ -155,4 +151,4 @@ void AsyncAcceptor::AsyncAccept()
|
||||
});
|
||||
}
|
||||
|
||||
#endif /* __ASYNCACCEPT_H_ */
|
||||
#endif /* __ASYNC ACCEPT_H_ */
|
||||
|
||||
@@ -73,12 +73,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
boost::asio::ip::address GetRemoteIpAddress() const
|
||||
[[nodiscard]] boost::asio::ip::address GetRemoteIpAddress() const
|
||||
{
|
||||
return _remoteAddress;
|
||||
}
|
||||
|
||||
uint16 GetRemotePort() const
|
||||
[[nodiscard]] uint16 GetRemotePort() const
|
||||
{
|
||||
return _remotePort;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsOpen() const { return !_closed && !_closing; }
|
||||
[[nodiscard]] bool IsOpen() const { return !_closed && !_closing; }
|
||||
|
||||
void CloseSocket()
|
||||
{
|
||||
@@ -146,7 +146,7 @@ protected:
|
||||
virtual void OnClose() { }
|
||||
virtual void ReadHandler() = 0;
|
||||
|
||||
bool AsyncProcessQueue()
|
||||
[[nodiscard]] bool AsyncProcessQueue()
|
||||
{
|
||||
if (_isWritingAsync)
|
||||
return false;
|
||||
|
||||
@@ -104,9 +104,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int32 GetNetworkThreadCount() const { return _threadCount; }
|
||||
[[nodiscard]] int32 GetNetworkThreadCount() const { return _threadCount; }
|
||||
|
||||
uint32 SelectThreadWithMinConnections() const
|
||||
[[nodiscard]] uint32 SelectThreadWithMinConnections() const
|
||||
{
|
||||
uint32 min = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user