Attempt to fix infinite loading screen if server restarts during MP login

See #2927.
This commit is contained in:
Charles Dang 2018-04-21 14:12:25 +11:00
parent 3797837c74
commit 8a00056a22
3 changed files with 10 additions and 1 deletions

View file

@ -104,6 +104,10 @@ std::pair<wesnothd_connection_ptr, config> open_connection(std::string host)
return std::make_pair(std::move(sock), config());
}
if(!sock->socket_open()) {
throw wesnothd_error("The server has shut down or restarted.");
}
data.clear();
sock->wait_and_receive_data(data);

View file

@ -186,7 +186,7 @@ void wesnothd_connection::send_data(const configr_of& request)
void wesnothd_connection::cancel()
{
MPTEST_LOG;
if(socket_.is_open()) {
if(socket_open()) {
boost::system::error_code ec;
#ifdef _MSC_VER

View file

@ -92,6 +92,11 @@ public:
// Destroys this object.
void stop();
bool socket_open() const
{
return socket_.is_open();
}
/** True if connected and no high-level operation is in progress */
bool handshake_finished() const
{