When the server closes the connection, set connected=false. That way, when the client closes, we don't try closing the already closed server socket.
@@ -430,6 +430,7 @@ void Session::server_read(void) {
server_read();
} else {
BUGZ_LOG(warning) << "S: read_failed: socket.shutdown()";
+ connected = false;
socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both);
}
});
@@ -652,6 +653,8 @@ void Session::to_server(const std::string &message) {
BUGZ_LOG(warning) << "S: write failed? closed? socket.shutdown()";
+ // we're no longer connected.