From d786e65a9a262638e74f6ebcf1b296917897ae49 Mon Sep 17 00:00:00 2001 From: boris Date: Sun, 30 Dec 2018 15:00:51 +1300 Subject: unban marcus or suffer my wrath grr --- csgo-loader/csgo-client/Networking/TCPClient.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'csgo-loader/csgo-client/Networking') diff --git a/csgo-loader/csgo-client/Networking/TCPClient.cpp b/csgo-loader/csgo-client/Networking/TCPClient.cpp index aeb2dfc..11d4677 100644 --- a/csgo-loader/csgo-client/Networking/TCPClient.cpp +++ b/csgo-loader/csgo-client/Networking/TCPClient.cpp @@ -12,7 +12,7 @@ namespace Networking int32_t Result = send(m_Socket, (char *)Bytes.data(), (int)Bytes.size(), 0); if(Result == -1) - INFO_ASSERT("[000F:00002B00] Server closed the connection suddenly."); + INFO_ASSERT("[000F:00002B00] Server closed the connection unexpectedly."); } ByteArray TCPClient::ReceiveRawBytes() @@ -32,7 +32,7 @@ namespace Networking // Emplace all received bytes. for(int n = 0; n < Received; ++n) { - ReceivedBytes.emplace_back(RecvBuffer[n]); + ReceivedBytes.push_back(RecvBuffer[n]); } // No more bytes left to receive. @@ -77,16 +77,12 @@ namespace Networking // Set up client context. m_Context.sin_addr.s_addr = ServerAddress; - m_Context.sin_family = AF_INET; - m_Context.sin_port = htons(ServerPort); - - // Attempt connection. - if(connect(m_Socket, (sockaddr *)&m_Context, sizeof m_Context)) - return false; - + m_Context.sin_family = AF_INET; + m_Context.sin_port = htons(ServerPort); + // Allow the socket to time-out. timeval timeout; - timeout.tv_sec = 30; + timeout.tv_sec = 5; if(setsockopt(m_Socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof timeout) == INVALID_SOCKET) return false; @@ -94,6 +90,10 @@ namespace Networking if(setsockopt(m_Socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof timeout) == INVALID_SOCKET) return false; + // Attempt connection. + if(connect(m_Socket, (sockaddr *)&m_Context, sizeof m_Context)) + return false; + // Initialise encryption wrapper. ByteArray EncryptionKey = ReceiveRawBytes(); m_Encryption.Start(EncryptionKey); -- cgit v1.2.3