summaryrefslogtreecommitdiff
path: root/kvmd/apps/vnc/server.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-06-02 20:59:43 +0300
committerDevaev Maxim <[email protected]>2020-06-02 20:59:43 +0300
commitcb9597679d8c9189e671e166de45c707c650bb2f (patch)
treee0f3e00bafe4c1674f8497e6832f292233d94821 /kvmd/apps/vnc/server.py
parentfe7c275d1a827f95d40d774e38b928aee493a41b (diff)
improved info handler
Diffstat (limited to 'kvmd/apps/vnc/server.py')
-rw-r--r--kvmd/apps/vnc/server.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py
index a5517c11..4d28555f 100644
--- a/kvmd/apps/vnc/server.py
+++ b/kvmd/apps/vnc/server.py
@@ -150,13 +150,17 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
async def __process_ws_event(self, event: Dict) -> None:
if event["event_type"] == "info_state":
- host = event["event"]["meta"].get("server", {}).get("host")
- if isinstance(host, str):
- name = f"Pi-KVM: {host}"
- async with self.__lock:
- if self._encodings.has_rename:
- await self._send_rename(name)
- self.__shared_params.name = name
+ try:
+ host = event["event"]["meta"]["server"]["host"]
+ except Exception:
+ host = None
+ else:
+ if isinstance(host, str):
+ name = f"Pi-KVM: {host}"
+ async with self.__lock:
+ if self._encodings.has_rename:
+ await self._send_rename(name)
+ self.__shared_params.name = name
elif event["event_type"] == "hid_state":
async with self.__lock: