summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-17 13:10:53 +0300
committerDevaev Maxim <[email protected]>2020-09-17 13:10:53 +0300
commit649ca0c6bcdb5f8073c7fb8f9a61684ae9ddf679 (patch)
tree0b182ad9a2b7087408af4e366732368d21b50988
parentf46c6f63729d1385634f00af5484013c613cae8f (diff)
option to stream forever
-rw-r--r--kvmd/apps/__init__.py2
-rw-r--r--kvmd/apps/kvmd/__init__.py4
-rw-r--r--kvmd/apps/kvmd/server.py6
3 files changed, 10 insertions, 2 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index ccede372..5a2b5244 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -314,6 +314,8 @@ def _get_config_scheme() -> Dict:
},
"streamer": {
+ "forever": Option(False, type=valid_bool),
+
"reset_delay": Option(1.0, type=valid_float_f0),
"shutdown_delay": Option(10.0, type=valid_float_f01),
"state_poll": Option(1.0, type=valid_float_f01),
diff --git a/kvmd/apps/kvmd/__init__.py b/kvmd/apps/kvmd/__init__.py
index bd08e157..e0b0024b 100644
--- a/kvmd/apps/kvmd/__init__.py
+++ b/kvmd/apps/kvmd/__init__.py
@@ -64,7 +64,7 @@ def main(argv: Optional[List[str]]=None) -> None:
config = config.kvmd
hid = get_hid_class(config.hid.type)(**config.hid._unpack(ignore=["type", "keymap"]))
- streamer = Streamer(**config.streamer._unpack())
+ streamer = Streamer(**config.streamer._unpack(ignore=["forever"]))
KvmdServer(
auth_manager=AuthManager(
@@ -95,6 +95,8 @@ def main(argv: Optional[List[str]]=None) -> None:
sync_chunk_size=config.server.sync_chunk_size,
keymap_path=config.hid.keymap,
+
+ stream_forever=config.streamer.forever,
).run(**config.server._unpack(ignore=["heartbeat", "sync_chunk_size"]))
get_logger(0).info("Bye-bye")
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py
index 3e3bf4a2..4003bf2b 100644
--- a/kvmd/apps/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -154,6 +154,8 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
sync_chunk_size: int,
keymap_path: str,
+
+ stream_forever: bool,
) -> None:
self.__auth_manager = auth_manager
@@ -164,6 +166,8 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
self.__heartbeat = heartbeat
+ self.__stream_forever = stream_forever
+
self.__components = [
*[
_Component("Auth manager", "", auth_manager),
@@ -399,7 +403,7 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
async def __stream_controller(self) -> None:
prev = False
while True:
- cur = (self.__has_stream_clients() or self.__snapshoter.snapshoting())
+ cur = (self.__has_stream_clients() or self.__snapshoter.snapshoting() or self.__stream_forever)
if not prev and cur:
await self.__streamer.ensure_start(reset=False)
elif prev and not cur: