summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-08-07 19:04:32 +0300
committerMaxim Devaev <[email protected]>2022-08-07 19:04:32 +0300
commitec9785b4be4afb8667e6968a0454aeca62a190e2 (patch)
tree0b5c7d1b03041867c78f5533a8dd8f488711b073 /kvmd/apps
parentaa630988cc09f31d412a62c5480d4bec1a7c626e (diff)
simplified AioNotifier()
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/server.py8
-rw-r--r--kvmd/apps/kvmd/snapshoter.py4
-rw-r--r--kvmd/apps/kvmd/streamer.py4
-rw-r--r--kvmd/apps/pst/server.py4
-rw-r--r--kvmd/apps/vnc/server.py6
5 files changed, 13 insertions, 13 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py
index 5adc8d8d..6cb2ef5e 100644
--- a/kvmd/apps/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -213,13 +213,13 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
value = validator(value) # type: ignore
if current_params[name] != value:
self.__new_streamer_params[name] = value
- await self.__streamer_notifier.notify()
+ self.__streamer_notifier.notify()
return make_json_response()
@exposed_http("POST", "/streamer/reset")
async def __streamer_reset_handler(self, _: Request) -> Response:
self.__reset_streamer = True
- await self.__streamer_notifier.notify()
+ self.__streamer_notifier.notify()
return make_json_response()
# ===== WEBSOCKET
@@ -299,11 +299,11 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
logger.info("On-Cleanup complete")
async def _on_ws_opened(self) -> None:
- await self.__streamer_notifier.notify()
+ self.__streamer_notifier.notify()
async def _on_ws_closed(self) -> None:
self.__hid.clear_events()
- await self.__streamer_notifier.notify()
+ self.__streamer_notifier.notify()
def __has_stream_clients(self) -> bool:
return bool(sum(map(
diff --git a/kvmd/apps/kvmd/snapshoter.py b/kvmd/apps/kvmd/snapshoter.py
index 0a8874a1..fed3de92 100644
--- a/kvmd/apps/kvmd/snapshoter.py
+++ b/kvmd/apps/kvmd/snapshoter.py
@@ -96,7 +96,7 @@ class Snapshoter: # pylint: disable=too-many-instance-attributes
logger.info("Time to take the new idle snapshot")
try:
self.__snapshoting = True
- await notifier.notify()
+ notifier.notify()
if not live:
await self.__wakeup()
@@ -116,7 +116,7 @@ class Snapshoter: # pylint: disable=too-many-instance-attributes
logger.exception("Unhandled exception while taking snapshot")
finally:
self.__snapshoting = False
- await asyncio.shield(notifier.notify())
+ notifier.notify()
async def __wakeup(self) -> None:
logger = get_logger(0)
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index 1e387240..cc753aff 100644
--- a/kvmd/apps/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -319,7 +319,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
async def poll_state(self) -> AsyncGenerator[Dict, None]:
def signal_handler(*_: Any) -> None:
get_logger(0).info("Got SIGUSR2, checking the stream state ...")
- asyncio.ensure_future(self.__notifier.notify())
+ self.__notifier.notify()
get_logger(0).info("Installing SIGUSR2 streamer handler ...")
asyncio.get_event_loop().add_signal_handler(signal.SIGUSR2, signal_handler)
@@ -370,7 +370,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
)
if save:
self.__snapshot = snapshot
- await self.__notifier.notify()
+ self.__notifier.notify()
return snapshot
logger.error("Stream is offline, no signal or so")
except (aiohttp.ClientConnectionError, aiohttp.ServerConnectionError) as err:
diff --git a/kvmd/apps/pst/server.py b/kvmd/apps/pst/server.py
index 968d322d..a492a29b 100644
--- a/kvmd/apps/pst/server.py
+++ b/kvmd/apps/pst/server.py
@@ -96,10 +96,10 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst
logger.info("On-Cleanup complete")
async def _on_ws_opened(self) -> None:
- await self.__notifier.notify()
+ self.__notifier.notify()
async def _on_ws_closed(self) -> None:
- await self.__notifier.notify()
+ self.__notifier.notify()
# ===== SYSTEM TASKS
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py
index 54974bfb..151f6374 100644
--- a/kvmd/apps/vnc/server.py
+++ b/kvmd/apps/vnc/server.py
@@ -294,7 +294,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
if len(last["data"]) == 0:
# Вдруг какой-то баг
- await self.__fb_notifier.notify()
+ self.__fb_notifier.notify()
continue
if last["format"] == StreamFormats.JPEG:
@@ -305,7 +305,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
if has_h264_key:
await self._send_fb_h264(last["data"])
else:
- await self.__fb_notifier.notify()
+ self.__fb_notifier.notify()
else:
raise RuntimeError(f"Unknown format: {last['format']}")
last["data"] = b""
@@ -406,7 +406,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
await self.__kvmd_session.streamer.set_params(quality, self.__desired_fps)
async def _on_fb_update_request(self) -> None:
- await self.__fb_notifier.notify()
+ self.__fb_notifier.notify()
# =====