mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Use str_hex() for CServer::ProcessClientPacket() debug output
This commit is contained in:
parent
6aaaaf1ab4
commit
92abe8d545
|
@ -1716,16 +1716,8 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
||||||
{
|
{
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
{
|
{
|
||||||
char aHex[] = "0123456789ABCDEF";
|
|
||||||
char aBuf[512];
|
char aBuf[512];
|
||||||
|
str_hex(aBuf, sizeof(aBuf), pPacket->m_pData, minimum(pPacket->m_DataSize, 32));
|
||||||
for(int b = 0; b < pPacket->m_DataSize && b < 32; b++)
|
|
||||||
{
|
|
||||||
aBuf[b * 3] = aHex[((const unsigned char *)pPacket->m_pData)[b] >> 4];
|
|
||||||
aBuf[b * 3 + 1] = aHex[((const unsigned char *)pPacket->m_pData)[b] & 0xf];
|
|
||||||
aBuf[b * 3 + 2] = ' ';
|
|
||||||
aBuf[b * 3 + 3] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char aBufMsg[256];
|
char aBufMsg[256];
|
||||||
str_format(aBufMsg, sizeof(aBufMsg), "strange message ClientID=%d msg=%d data_size=%d", ClientID, Msg, pPacket->m_DataSize);
|
str_format(aBufMsg, sizeof(aBufMsg), "strange message ClientID=%d msg=%d data_size=%d", ClientID, Msg, pPacket->m_DataSize);
|
||||||
|
|
Loading…
Reference in a new issue