mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-22 02:51:32 +03:00
handle client disconnection without crashing
This commit is contained in:
parent
ef01cf71ff
commit
1d790541f5
@ -335,13 +335,25 @@ bool RemoteUI::is_key_available()
|
||||
|
||||
Key RemoteUI::get_key()
|
||||
{
|
||||
Key key = read<Key>(m_socket_watcher.fd());
|
||||
if (key.modifiers == resize_modifier)
|
||||
try
|
||||
{
|
||||
m_dimensions = { (int)(key.key >> 16), (int)(key.key & 0xFFFF) };
|
||||
return Key::Invalid;
|
||||
Key key = read<Key>(m_socket_watcher.fd());
|
||||
if (key.modifiers == resize_modifier)
|
||||
{
|
||||
m_dimensions = { (int)(key.key >> 16), (int)(key.key & 0xFFFF) };
|
||||
return Key::Invalid;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
catch (peer_disconnected&)
|
||||
{
|
||||
throw client_removed{};
|
||||
}
|
||||
catch (socket_error&)
|
||||
{
|
||||
write_debug("ungraceful deconnection detected");
|
||||
throw client_removed{};
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
DisplayCoord RemoteUI::dimensions()
|
||||
|
Loading…
Reference in New Issue
Block a user