diff options
| author | Shauren <shauren.trinity@gmail.com> | 2025-09-22 16:12:01 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2025-09-22 16:12:01 +0200 |
| commit | df02bec2a1871267548494bc473711a0f9de9b43 (patch) | |
| tree | 9e1951fca316ecd0ad48ee7428a0b33bdd79d4f0 /src/common/network/Socket.h | |
| parent | bb1cc8a48f8f3472ebdfdbaa6a97ec2e1c5190c8 (diff) | |
Core/Network: Minor include cleanup in SocketConnectionInitializer related files
Diffstat (limited to 'src/common/network/Socket.h')
| -rw-r--r-- | src/common/network/Socket.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/network/Socket.h b/src/common/network/Socket.h index c2b2c63a291..aa2060691d5 100644 --- a/src/common/network/Socket.h +++ b/src/common/network/Socket.h @@ -31,7 +31,6 @@ #include <queue> #include <type_traits> -#define READ_BLOCK_SIZE 4096 #ifdef BOOST_ASIO_HAS_IOCP #define TC_SOCKET_USE_IOCP #endif @@ -70,20 +69,21 @@ struct InvokeReadHandlerCallback SocketType* Socket; }; -template <typename SocketType> +template <typename AsyncReadObjectType, typename ReadHandlerObjectType = AsyncReadObjectType> struct ReadConnectionInitializer final : SocketConnectionInitializer { - explicit ReadConnectionInitializer(SocketType* socket) : ReadCallback({ .Socket = socket }) { } + explicit ReadConnectionInitializer(AsyncReadObjectType* socket) : Socket(socket), ReadCallback({ .Socket = socket }) { } + explicit ReadConnectionInitializer(AsyncReadObjectType* socket, ReadHandlerObjectType* callbackSocket) : Socket(socket), ReadCallback({ .Socket = callbackSocket }) { } void Start() override { - ReadCallback.Socket->AsyncRead(std::move(ReadCallback)); + Socket->AsyncRead(std::move(ReadCallback)); - if (this->next) - this->next->Start(); + this->InvokeNext(); } - InvokeReadHandlerCallback<SocketType> ReadCallback; + AsyncReadObjectType* Socket; + InvokeReadHandlerCallback<ReadHandlerObjectType> ReadCallback; }; /** @@ -383,7 +383,7 @@ private: boost::asio::ip::address _remoteAddress; uint16 _remotePort = 0; - MessageBuffer _readBuffer = MessageBuffer(READ_BLOCK_SIZE); + MessageBuffer _readBuffer = MessageBuffer(0x1000); std::queue<MessageBuffer> _writeQueue; // Socket open state "enum" (not enum to enable integral std::atomic api) |
