diff options
| author | boris <wzn@moneybot.cc> | 2018-12-30 15:00:51 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-12-30 15:00:51 +1300 |
| commit | d786e65a9a262638e74f6ebcf1b296917897ae49 (patch) | |
| tree | 17199ab95db8a59abf4d3bf40543296d76e8659e /csgo-loader/csgo-client/Networking | |
| parent | 0340821cc614fda2a94a96c255d16105dd2f6f9a (diff) | |
unban marcus or suffer my wrath
grr
Diffstat (limited to 'csgo-loader/csgo-client/Networking')
| -rw-r--r-- | csgo-loader/csgo-client/Networking/TCPClient.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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);
|
