Core/PacketIO: Implemented CMSG_ENABLE_NAGLE

This commit is contained in:
Shauren
2015-03-28 20:51:01 +01:00
parent e6f9006f95
commit 5ac0b7844c
4 changed files with 12 additions and 13 deletions

View File

@@ -805,13 +805,6 @@ void WorldSession::HandleRequestAccountData(WorldPackets::ClientConfig::RequestA
SendPacket(data.Write());
}
int32 WorldSession::HandleEnableNagleAlgorithm()
{
// Instructs the server we wish to receive few amounts of large packets (SMSG_MULTIPLE_PACKETS?)
// instead of large amount of small packets
return 0;
}
void WorldSession::HandleSetActionButtonOpcode(WorldPackets::Spells::SetActionButton& packet)
{
uint32 action = ACTION_BUTTON_ACTION(packet.Action);
@@ -1132,7 +1125,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
void WorldSession::HandleSetTitleOpcode(WorldPackets::Character::SetTitle& packet)
{
TC_LOG_DEBUG("network", "CMSG_SET_TITLE");
// -1 at none
if (packet.TitleID > 0 && packet.TitleID < MAX_TITLE_INDEX)
{

View File

@@ -1355,8 +1355,6 @@ class WorldSession
void SendSpellCategoryCooldowns();
int32 HandleEnableNagleAlgorithm();
// Compact Unit Frames (4.x)
void HandleSaveCUFProfiles(WorldPacket& recvPacket);
void SendLoadCUFProfiles();

View File

@@ -261,10 +261,9 @@ bool WorldSocket::ReadDataHandler()
return true;
case CMSG_ENABLE_NAGLE:
{
TC_LOG_DEBUG("network", "%s", GetOpcodeNameForLogging(opcode).c_str());
TC_LOG_DEBUG("network", "Client %s requested enabling nagle algorithm", GetRemoteIpAddress().to_string().c_str());
sScriptMgr->OnPacketReceive(_worldSession, packet);
if (_worldSession)
_worldSession->HandleEnableNagleAlgorithm();
SetNoDelay(false);
break;
}
case CMSG_CONNECT_TO_FAILED:

View File

@@ -169,6 +169,15 @@ protected:
return false;
}
void SetNoDelay(bool enable)
{
boost::system::error_code err;
_socket.set_option(boost::asio::ip::tcp::no_delay(enable), err);
if (err)
TC_LOG_DEBUG("network", "Socket::SetNoDelay: failed to set_option(boost::asio::ip::tcp::no_delay) for %s - %d (%s)",
GetRemoteIpAddress().to_string().c_str(), err.value(), err.message().c_str());
}
std::mutex _writeLock;
std::queue<MessageBuffer> _writeQueue;
#ifndef TC_SOCKET_USE_IOCP