Core/RA: Workaround for telnet active mode

Add a workaround for telnet connections with active mode. A proper fix would require boost tcp::socket to support timeout on receive.
This commit is contained in:
jackpoz
2014-08-27 21:47:05 +02:00
parent b56cfeb45e
commit 66f4b51d6f

View File

@@ -31,12 +31,12 @@ using boost::asio::ip::tcp;
void RASession::Start()
{
boost::asio::socket_base::bytes_readable command(true);
_socket.io_control(command);
std::size_t bytes_readable = command.get();
// wait 1 second for active connections to send negotiation request
for (int counter = 0; counter < 10 && _socket.available() == 0; counter++)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
// Check if there are bytes available, if they are, then the client is requesting the negotiation
if (bytes_readable > 0)
if (_socket.available() > 0)
{
// Handle subnegotiation
boost::array<char, 1024> buf;