Просмотр исходного кода

Fixed Exception: shutdown: Transport endpoint is not connected

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.
Steve Thielemann 3 лет назад
Родитель
Сommit
0be6e6bac2
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      session.cpp

+ 3 - 0
session.cpp

@@ -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) {
 
         } else {
           BUGZ_LOG(warning) << "S: write failed? closed? socket.shutdown()";
+          // we're no longer connected.
+          connected = false;
           socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both);
         }
       });