diff options
author | jackpoz <giacomopoz@gmail.com> | 2014-08-27 21:47:05 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2014-08-27 22:10:07 +0200 |
commit | 66f4b51d6f9dfa0dbeaf7f228d1f2bf9fac05590 (patch) | |
tree | 51047f2cb1bd3918ca507d7e600a929f88052309 | |
parent | b56cfeb45e324e1a65f194b625364b58efbe1cc9 (diff) |
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.
-rw-r--r-- | src/server/worldserver/RemoteAccess/RASession.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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<char, 1024> buf; |