diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-07-27 14:59:46 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-07-27 14:59:46 +0200 |
commit | e77c0b6ed4516c09c648a6443b054b8b9e1edcf1 (patch) | |
tree | 68fdd1e6a6995f211292b494c7352ed207fe1a7c /src/server/authserver/Server/AuthSession.cpp | |
parent | 6699d969f3114b60109288caebee7b5d7d86b61e (diff) |
Core/Network: Allow storing any packet types in Socket write queue to reduce the amount of copying going on
Diffstat (limited to 'src/server/authserver/Server/AuthSession.cpp')
-rw-r--r-- | src/server/authserver/Server/AuthSession.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index cc5dc8cbb1b..697fe027f5e 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -18,7 +18,6 @@ #include "AuthSession.h" #include "Log.h" -#include "ByteBuffer.h" #include "AuthCodes.h" #include "Database/DatabaseEnv.h" #include "SHA1.h" @@ -173,19 +172,16 @@ void AuthSession::ReadDataHandler(boost::system::error_code error, size_t transf CloseSocket(); } -void AuthSession::AsyncWrite(ByteBuffer const& packet) +void AuthSession::AsyncWrite(ByteBuffer& packet) { - std::vector<uint8> data(packet.size()); - std::memcpy(data.data(), packet.contents(), packet.size()); - std::lock_guard<std::mutex> guard(_writeLock); bool needsWriteStart = _writeQueue.empty(); - _writeQueue.push(std::move(data)); + _writeQueue.push(std::move(packet)); if (needsWriteStart) - AsyncWrite(_writeQueue.front()); + Base::AsyncWrite(_writeQueue.front()); } bool AuthSession::HandleLogonChallenge() |