- add 120 seconds timeout

This commit is contained in:
Anonymous275 2022-12-23 16:24:24 +00:00 committed by Simon
parent 688e46f524
commit 4b30918659

View File

@ -11,6 +11,8 @@
#include <boost/asio/ip/address_v4.hpp>
#include <cstring>
typedef boost::asio::detail::socket_option::integer<SOL_SOCKET, SO_RCVTIMEO> rcv_timeout_option;
std::vector<uint8_t> StringToVector(const std::string& Str) {
return std::vector<uint8_t>(Str.data(), Str.data() + Str.size());
}
@ -151,6 +153,7 @@ void TNetwork::TCPServerMain() {
if (ec) {
beammp_errorf("failed to accept: {}", ec.message());
}
ClientSocket.set_option(rcv_timeout_option{ 120000 }); //timeout of 120seconds
TConnection Conn { std::move(ClientSocket), ClientEp };
std::thread ID(&TNetwork::Identify, this, std::move(Conn));
ID.detach(); // TODO: Add to a queue and attempt to join periodically