From cdc11d8a7b075fb4284a03ffec6a3f0dbceb6604 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Mon, 8 Feb 2021 17:25:52 +0300 Subject: [PATCH] Prevent hang in case of connecting to old server not supporting new handshake value --- src/wesnothd_connection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wesnothd_connection.cpp b/src/wesnothd_connection.cpp index a320fcac6b88..986a7ce6defb 100644 --- a/src/wesnothd_connection.cpp +++ b/src/wesnothd_connection.cpp @@ -164,6 +164,9 @@ void wesnothd_connection::handle_handshake(const error_code& ec) { MPTEST_LOG; if(ec) { + if(ec == boost::asio::error::eof) { + throw std::runtime_error("Failed to complete handshake with server"); + } LOG_NW << __func__ << " Throwing: " << ec << "\n"; throw system_error(ec); }