diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-07-29 01:52:28 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-07-29 01:52:28 +0200 |
| commit | 6418789489e984ec800578c09a3c385b2b0c3b72 (patch) | |
| tree | a1191843657b8deadc0f0b34140cb9ee79d29607 /src | |
| parent | dd6bae82ad9a82a08cdeee31fd7c271d29b28b95 (diff) | |
Core/Socket: Fixed expected template evaluated type for AsyncWrite if PacketType is a pointer (Bla* const& is not what we want)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/shared/Networking/Socket.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h index 059de140797..d9d03b8bbd9 100644 --- a/src/server/shared/Networking/Socket.h +++ b/src/server/shared/Networking/Socket.h @@ -34,6 +34,8 @@ using boost::asio::ip::tcp; template<class T, class PacketType> class Socket : public std::enable_shared_from_this<T> { + typedef std::conditional<std::is_pointer<PacketType>::value, PacketType, PacketType const&>::type WritePacketType; + public: Socket(tcp::socket&& socket, std::size_t headerSize) : _socket(std::move(socket)), _headerSize(headerSize) { } @@ -93,7 +95,7 @@ public: } } - void AsyncWrite(PacketType const& data) + void AsyncWrite(WritePacketType data) { boost::asio::async_write(_socket, boost::asio::buffer(data), std::bind(&Socket<T, PacketType>::WriteHandler, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); |
