1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-22 19:11:40 +03:00

handle client disconnection without crashing

This commit is contained in:
Maxime Coste 2013-08-28 19:19:54 +01:00
parent ef01cf71ff
commit 1d790541f5

View File

@ -335,6 +335,8 @@ bool RemoteUI::is_key_available()
Key RemoteUI::get_key() Key RemoteUI::get_key()
{ {
try
{
Key key = read<Key>(m_socket_watcher.fd()); Key key = read<Key>(m_socket_watcher.fd());
if (key.modifiers == resize_modifier) if (key.modifiers == resize_modifier)
{ {
@ -342,6 +344,16 @@ Key RemoteUI::get_key()
return Key::Invalid; return Key::Invalid;
} }
return key; return key;
}
catch (peer_disconnected&)
{
throw client_removed{};
}
catch (socket_error&)
{
write_debug("ungraceful deconnection detected");
throw client_removed{};
}
} }
DisplayCoord RemoteUI::dimensions() DisplayCoord RemoteUI::dimensions()