Tolerate unwritable socket when trying to send the disconnection message

Fixes #1552
This commit is contained in:
Maxime Coste 2017-09-07 19:37:58 +08:00
parent 8e3e5b10c1
commit bd66aff808

View File

@ -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();