From 66f4b51d6f9dfa0dbeaf7f228d1f2bf9fac05590 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Wed, 27 Aug 2014 21:47:05 +0200 Subject: 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. --- src/server/worldserver/RemoteAccess/RASession.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/worldserver/RemoteAccess/RASession.cpp index 846a4eb39e3..9892019ae5a 100644 --- a/src/server/worldserver/RemoteAccess/RASession.cpp +++ b/src/server/worldserver/RemoteAccess/RASession.cpp @@ -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 buf; -- cgit v1.2.3