aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/shared/Networking/Socket.h4
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));