From 0340821cc614fda2a94a96c255d16105dd2f6f9a Mon Sep 17 00:00:00 2001 From: boris Date: Sat, 29 Dec 2018 22:15:34 +1300 Subject: tcp is being autistic -_- --- csgo-loader/csgo-server/Networking/TCPServer.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'csgo-loader/csgo-server/Networking/TCPServer.cpp') diff --git a/csgo-loader/csgo-server/Networking/TCPServer.cpp b/csgo-loader/csgo-server/Networking/TCPServer.cpp index 739cbdd..c381c85 100644 --- a/csgo-loader/csgo-server/Networking/TCPServer.cpp +++ b/csgo-loader/csgo-server/Networking/TCPServer.cpp @@ -4,7 +4,7 @@ namespace Networking { void TCPConnection::Close() { - printf("[ <= ] %s disconnected!\n", m_IpAddress); + printf("[ <= ] disconnected\n"); if(m_Socket) closesocket(m_Socket); @@ -20,10 +20,10 @@ namespace Networking if(m_IpAddress) - printf("[ => ] Sending %zd bytes to %s.\n", Bytes.size(), m_IpAddress); + printf("[ => ] %zd bytes\n", Bytes.size()); if(Result == -1) - printf("[ => ] Failed to send %zd bytes to %s. (Socket %04Ix)\n", Bytes.size(), m_IpAddress, m_Socket); + printf("[ => ] %zd bytes failed (%d)\n", Bytes.size(), WSAGetLastError()); } ByteArray TCPConnection::ReceiveRawBytes() @@ -43,7 +43,7 @@ namespace Networking // Emplace all received bytes. for(int n = 0; n < Received; ++n) { - ReceivedBytes.push_back(RecvBuffer[n]); + ReceivedBytes.emplace_back(RecvBuffer[n]); } // No more bytes left to receive. @@ -51,7 +51,7 @@ namespace Networking break; } - printf("[ <= ] Received %zd bytes from %s.\n", ReceivedBytes.size(), m_IpAddress); + printf("[ <= ] %zd bytes\n", ReceivedBytes.size()); return ReceivedBytes; } @@ -126,6 +126,14 @@ namespace Networking ByteArray EncryptionKey = Connection.GetEncryptionKey(); Connection.SendRawBytes(EncryptionKey); + // Print out handshake header + printf("[ => ] Handshake: "); + + for(auto &It : EncryptionKey) + printf("%02x ", It); + + printf("\n"); + // Detach a thread to handle the connection. std::thread thread([&] { -- cgit v1.2.3