[8798] Partly revert and optimize [8797]

* Revert realmd changes:
  - typos in prev. commit prevent correct work of realmd code.
  - useless log login packets
  - and really horrible idea log of patch packets (how nice convert some MB in hex strings)
* Revert output world packet format to more readable old but output timestamp
* Drop outWorld, but use explcit fprintf calls into new outWorldPacketDump.
  Not nice have 16 flush calls at hex line.
This commit is contained in:
VladimirMangos 2009-11-09 15:06:36 +03:00
parent 07aa44992b
commit ea7100ff63
8 changed files with 39 additions and 112 deletions

View file

@ -22,6 +22,7 @@
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "ByteBuffer.h"
#include "Config/ConfigEnv.h"
#include "Log.h"
#include "RealmList.h"
@ -251,37 +252,14 @@ void AuthSocket::OnRead()
///- Read the packet
TcpSocket::OnRead();
uint8 _cmd;
while (true)
while (1)
{
if (!ibuf.GetLength())
return;
///- Get the command out of it. We can assume it's there, since length is not 0.
///- Get the command out of it
ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ???
// Dump incoming packet.
if (sLog.IsLogWorld())
{
sLog.outWorld ("C->S - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n",
GetSocket(), ibuf.GetLength(), _cmd);
size_t p = 0;
while (p < ibuf.GetLength())
{
char dest;
for (size_t j = 0; j < 16 && p < ibuf.GetLength(); ++j)
{
ibuf.SoftRead(&dest, 1);
sLog.outWorld("%.2X ", *((uint8*)dest));
p++;
}
sLog.outWorld("\n");
}
sLog.outWorld("\n\n");
}
size_t i;
///- Circle through known commands and call the correct command handler
@ -311,34 +289,7 @@ void AuthSocket::OnRead()
}
}
void AuthSocket::SendPacket(ByteBuffer* buf)
{
// TODO: Also handle outgoing structs?
uint8 _cmd = buf->read<uint8>();
// Dump outgoing packet.
if (sLog.IsLogWorld())
{
sLog.outWorld ("S->C - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n",
GetSocket(), buf->size(), _cmd);
size_t p = 0;
while (p < buf->size())
{
for (size_t j = 0; j < 16 && p < buf->size(); ++j)
sLog.outWorld("%.2X ", (*buf)[p++]);
sLog.outWorld("\n");
}
sLog.outWorld("\n\n");
}
SendBuf((char const*)buf->contents(), buf->size());
}
/// Make the SRP6 calculation from hash in DB
/// Make the SRP6 calculation from hash in dB
void AuthSocket::_SetVSFields(const std::string& rI)
{
s.SetRand(s_BYTE_SIZE * 8);
@ -570,8 +521,7 @@ bool AuthSocket::_HandleLogonChallenge()
pkt<< (uint8) REALM_AUTH_NO_MATCH;
}
}
SendPacket(&pkt);
SendBuf((char const*)pkt.contents(), pkt.size());
return true;
}
@ -617,7 +567,7 @@ bool AuthSocket::_HandleLogonProof()
pkt << (uint8) REALM_AUTH_WRONG_BUILD_NUMBER;
DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build);
DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp);
SendPacket(&pkt);
SendBuf((char const*)pkt.contents(), pkt.size());
return true;
}
else // have patch
@ -857,7 +807,7 @@ bool AuthSocket::_HandleReconnectChallenge()
_reconnectProof.SetRand(16 * 8);
pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random
pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros
SendPacket(&pkt);
SendBuf((char const*)pkt.contents(), pkt.size());
return true;
}
@ -889,7 +839,7 @@ bool AuthSocket::_HandleReconnectProof()
pkt << (uint8) AUTH_RECONNECT_PROOF;
pkt << (uint8) 0x00;
pkt << (uint16) 0x00; // 2 bytes zeros
SendPacket(&pkt);
SendBuf((char const*)pkt.contents(), pkt.size());
///- Set _authed to true!
_authed = true;
@ -971,7 +921,7 @@ bool AuthSocket::_HandleRealmList()
hdr << (uint16)pkt.size();
hdr.append(pkt);
SendPacket(&pkt);
SendBuf((char const*)hdr.contents(), hdr.size());
return true;
}