From bd66aff808350e8d51246f184e121c0224d166a3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 7 Sep 2017 19:37:58 +0800 Subject: [PATCH] Tolerate unwritable socket when trying to send the disconnection message Fixes #1552 --- src/remote.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/remote.cc b/src/remote.cc index c26aabb7..2bf6f03b 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -419,7 +419,13 @@ RemoteUI::RemoteUI(int socket, DisplayCoord dimensions) RemoteUI::~RemoteUI() { // Try to send the remaining data if possible, as it might contain the desired exit status - send_data(m_socket_watcher.fd(), m_send_buffer); + try + { + send_data(m_socket_watcher.fd(), m_send_buffer); + } + catch (disconnected&) + { + } write_to_debug_buffer(format("remote client disconnected: {}", m_socket_watcher.fd())); m_socket_watcher.close_fd();