summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-03-04 04:18:35 +0300
committerDevaev Maxim <[email protected]>2020-03-04 04:18:35 +0300
commit779a9f1d1527edd89bc9d72a9b9d4cb0cbbef457 (patch)
tree164f3219a98b06a6fa01d964d78a38d91daa09a1
parent52e117df3c1fbfc29524ca9d06e49605b3ec5992 (diff)
receiving ustreamer signals
-rw-r--r--PKGBUILD2
-rw-r--r--configs/kvmd/main/v0-hdmi-rpi2.yaml1
-rw-r--r--configs/kvmd/main/v0-hdmi-rpi3.yaml1
-rw-r--r--configs/kvmd/main/v0-vga-rpi2.yaml1
-rw-r--r--configs/kvmd/main/v0-vga-rpi3.yaml1
-rw-r--r--configs/kvmd/main/v1-hdmi-rpi2.yaml1
-rw-r--r--configs/kvmd/main/v1-hdmi-rpi3.yaml1
-rw-r--r--configs/kvmd/main/v1-vga-rpi2.yaml1
-rw-r--r--configs/kvmd/main/v1-vga-rpi3.yaml1
-rw-r--r--configs/kvmd/main/v2-hdmi-rpi4.yaml1
-rw-r--r--configs/kvmd/main/v2-hdmi-zerow.yaml1
-rw-r--r--kvmd/apps/kvmd/streamer.py16
-rw-r--r--testenv/v1-vga-rpi3.override.yaml1
-rw-r--r--testenv/v2-hdmi-rpi4.override.yaml1
14 files changed, 28 insertions, 2 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 710ac08f..1a702977 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -47,7 +47,7 @@ depends=(
patch
sudo
raspberrypi-io-access
- "ustreamer>=1.9"
+ "ustreamer>=1.13"
)
makedepends=(python-setuptools)
source=("$url/archive/v$pkgver.tar.gz")
diff --git a/configs/kvmd/main/v0-hdmi-rpi2.yaml b/configs/kvmd/main/v0-hdmi-rpi2.yaml
index 3840d16e..ba532e8b 100644
--- a/configs/kvmd/main/v0-hdmi-rpi2.yaml
+++ b/configs/kvmd/main/v0-hdmi-rpi2.yaml
@@ -47,6 +47,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v0-hdmi-rpi3.yaml b/configs/kvmd/main/v0-hdmi-rpi3.yaml
index 3840d16e..ba532e8b 100644
--- a/configs/kvmd/main/v0-hdmi-rpi3.yaml
+++ b/configs/kvmd/main/v0-hdmi-rpi3.yaml
@@ -47,6 +47,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v0-vga-rpi2.yaml b/configs/kvmd/main/v0-vga-rpi2.yaml
index cc3ff62a..dd8cf024 100644
--- a/configs/kvmd/main/v0-vga-rpi2.yaml
+++ b/configs/kvmd/main/v0-vga-rpi2.yaml
@@ -48,6 +48,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v0-vga-rpi3.yaml b/configs/kvmd/main/v0-vga-rpi3.yaml
index cc3ff62a..dd8cf024 100644
--- a/configs/kvmd/main/v0-vga-rpi3.yaml
+++ b/configs/kvmd/main/v0-vga-rpi3.yaml
@@ -48,6 +48,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v1-hdmi-rpi2.yaml b/configs/kvmd/main/v1-hdmi-rpi2.yaml
index 61e5d74f..b2bca70e 100644
--- a/configs/kvmd/main/v1-hdmi-rpi2.yaml
+++ b/configs/kvmd/main/v1-hdmi-rpi2.yaml
@@ -52,6 +52,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v1-hdmi-rpi3.yaml b/configs/kvmd/main/v1-hdmi-rpi3.yaml
index 61e5d74f..b2bca70e 100644
--- a/configs/kvmd/main/v1-hdmi-rpi3.yaml
+++ b/configs/kvmd/main/v1-hdmi-rpi3.yaml
@@ -52,6 +52,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v1-vga-rpi2.yaml b/configs/kvmd/main/v1-vga-rpi2.yaml
index c4849717..1316ac8f 100644
--- a/configs/kvmd/main/v1-vga-rpi2.yaml
+++ b/configs/kvmd/main/v1-vga-rpi2.yaml
@@ -56,6 +56,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v1-vga-rpi3.yaml b/configs/kvmd/main/v1-vga-rpi3.yaml
index c4849717..1316ac8f 100644
--- a/configs/kvmd/main/v1-vga-rpi3.yaml
+++ b/configs/kvmd/main/v1-vga-rpi3.yaml
@@ -56,6 +56,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v2-hdmi-rpi4.yaml b/configs/kvmd/main/v2-hdmi-rpi4.yaml
index 32904c20..3c9dc927 100644
--- a/configs/kvmd/main/v2-hdmi-rpi4.yaml
+++ b/configs/kvmd/main/v2-hdmi-rpi4.yaml
@@ -49,6 +49,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/configs/kvmd/main/v2-hdmi-zerow.yaml b/configs/kvmd/main/v2-hdmi-zerow.yaml
index 842d750e..4d9cd5fd 100644
--- a/configs/kvmd/main/v2-hdmi-zerow.yaml
+++ b/configs/kvmd/main/v2-hdmi-zerow.yaml
@@ -49,6 +49,7 @@ kvmd:
- "--unix-mode=0660"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
ipmi:
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index 999033a7..ba2e4c53 100644
--- a/kvmd/apps/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -29,6 +29,7 @@ from typing import List
from typing import Dict
from typing import AsyncGenerator
from typing import Optional
+from typing import Any
import aiohttp
@@ -197,13 +198,26 @@ class Streamer: # pylint: disable=too-many-instance-attributes
}
async def poll_state(self) -> AsyncGenerator[Dict, None]:
+ notifier = aiotools.AioNotifier()
+
+ def signal_handler(*_: Any) -> None:
+ get_logger(0).info("Got SIGUSR2, checking the stream state ...")
+ asyncio.ensure_future(notifier.notify())
+
+ get_logger(0).info("Installing SIGUSR2 streamer handler ...")
+ asyncio.get_event_loop().add_signal_handler(signal.SIGUSR2, signal_handler)
+
prev_state: Dict = {}
while True:
state = await self.get_state()
if state != prev_state:
yield state
prev_state = state
- await asyncio.sleep(self.__state_poll)
+
+ await asyncio.wait([
+ asyncio.sleep(self.__state_poll),
+ notifier.wait(),
+ ], return_when=asyncio.FIRST_COMPLETED)
async def get_info(self) -> Dict:
proc = await asyncio.create_subprocess_exec(
diff --git a/testenv/v1-vga-rpi3.override.yaml b/testenv/v1-vga-rpi3.override.yaml
index d1eee78b..eb75d942 100644
--- a/testenv/v1-vga-rpi3.override.yaml
+++ b/testenv/v1-vga-rpi3.override.yaml
@@ -21,4 +21,5 @@ kvmd:
- "--unix-mode=0666"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"
diff --git a/testenv/v2-hdmi-rpi4.override.yaml b/testenv/v2-hdmi-rpi4.override.yaml
index a205d666..fb05fd59 100644
--- a/testenv/v2-hdmi-rpi4.override.yaml
+++ b/testenv/v2-hdmi-rpi4.override.yaml
@@ -29,4 +29,5 @@ kvmd:
- "--unix-mode=0666"
- "--exit-on-parent-death"
- "--process-name-prefix={process_name_prefix}"
+ - "--notify-parent"
- "--no-log-colors"