Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/scat/writers/pcapwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import struct

from scat.writers.abstractwriter import AbstractWriter
from scat.writers.systemd_notify import systemd_notify_watchdog_alive

class PcapWriter(AbstractWriter):
def __init__(self, filename: str, port_cp: int = 4729, port_up: int = 47290):
Expand Down Expand Up @@ -66,6 +67,7 @@ def write_pkt(self, sock_content: bytes, port: int, radio_id: int=0, ts: datetim
self.ip_id = 0

def write_cp(self, sock_content: bytes, radio_id: int=0, ts: datetime.datetime=datetime.datetime.now()):
systemd_notify_watchdog_alive()
self.write_pkt(sock_content, self.port_cp, radio_id, ts)

def write_up(self, sock_content: bytes, radio_id: int=0, ts: datetime.datetime=datetime.datetime.now()):
Expand Down
2 changes: 2 additions & 0 deletions src/scat/writers/rawwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# coding: utf8

from scat.writers.abstractwriter import AbstractWriter
from scat.writers.systemd_notify import systemd_notify_watchdog_alive

class RawWriter(AbstractWriter):
def __init__(self, fname: str, header: bytes=b'', trailer: bytes=b''):
Expand All @@ -13,6 +14,7 @@ def __enter__(self):
return self

def write_cp(self, sock_content: bytes, radio_id: int=0, ts: None = None):
systemd_notify_watchdog_alive()
self.raw_file.write(sock_content)

def write_up(self, sock_content: bytes, radio_id: int=0, ts: None = None):
Expand Down
2 changes: 2 additions & 0 deletions src/scat/writers/socketwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import struct

from scat.writers.abstractwriter import AbstractWriter
from scat.writers.systemd_notify import systemd_notify_watchdog_alive

class SocketWriter(AbstractWriter):
def __init__(self, base_address: str, port_cp: int = 4729, port_up: int = 47290):
Expand All @@ -21,6 +22,7 @@ def __enter__(self):
return self

def write_cp(self, sock_content: bytes, radio_id: int=0, ts: None = None):
systemd_notify_watchdog_alive()
if radio_id <= 0:
dest_address = self.base_address
else:
Expand Down
4 changes: 4 additions & 0 deletions src/scat/writers/systemd_notify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import subprocess

def systemd_notify_watchdog_alive():
subprocess.run(["systemd-notify", "WATCHDOG=1"], check=True)