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 +++++++++++++----- csgo-loader/csgo-server/Networking/TCPServer.hpp | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'csgo-loader/csgo-server/Networking') 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([&] { diff --git a/csgo-loader/csgo-server/Networking/TCPServer.hpp b/csgo-loader/csgo-server/Networking/TCPServer.hpp index 092254d..31beec8 100644 --- a/csgo-loader/csgo-server/Networking/TCPServer.hpp +++ b/csgo-loader/csgo-server/Networking/TCPServer.hpp @@ -29,7 +29,7 @@ namespace Networking TCPConnection(SOCKET Connection, const char *IpAddress, Wrapper::Encryption &RSA) : m_Encryption(RSA), m_Socket(Connection), m_IpAddress(IpAddress) { - printf("[ => ] %s connected!\n", IpAddress); + printf("[ => ] connected\n"); } // Release the connection once it goes out of scope. -- cgit v1.2.3