Mykola Karpets 6632b716b8 Add systemd socket activation capability
Add support for a systemd.socket activation. Socket it passed from
systemd via file descriptor (see systemd.socket doc)
Also, added a few features for convenience:
  * --conn/conv-timeout options to control conversation and connection
    timeouts
  * --shutdown option to shutdown service after all connections are
    timeouted. This is for convent usage with systemd.socket
  * test script which allows to smoke test udp speeder and its
    socket activation capability
  * example systemd unit files
2025-03-10 18:49:48 +02:00

1.8 KiB

Testing UDP speeder

Build

export UDP_SPEEDER_REPO=<path to UPDspeeder repo>
make -C ${UDP_SPEEDER_REPO}

Simple test

# Start server
python3 ${UDP_SPEEDER_REPO}/test/udp_speeder_test.py    \
    --speederv2-path ${UDP_SPEEDER_REPO}/speederv2      \
    --mode server                                       \
    --extra-args "--conn-timeout 20 --conv-timeout 10"  \
    --log-level info

# Start client
python3 ${UDP_SPEEDER_REPO}/test/udp_speeder_test.py            \
    --speederv2-path ${UDP_SPEEDER_REPO}/UDPspeeder/speederv2   \
    --mode client                                               \
    --log-level info

Test with systemd-socket-activate

# Start server with --socket-activate
python3 ${UDP_SPEEDER_REPO}/test/udp_speeder_test.py    \
    --speederv2-path ${UDP_SPEEDER_REPO}/speederv2      \
    --mode server                                       \
    --socket-activate                                   \
    --extra-args "--conn-timeout 20 --conv-timeout 10"  \
    --log-level info

#Start client

Test with real systemd units

# Add unit files
sudo ln -s ${UDP_SPEEDER_REPO}/test/udp_speeder.socket /etc/systemd/system/
sudo ln -s ${UDP_SPEEDER_REPO}/test/udp_speeder.service /etc/systemd/system/

# Enable them to systemd
sudo systemctl daemon-reload
sudo systemctl enable udp_speeder.socket
sudo systemctl enable udp_speeder.socket

# Observe status and logs
sudo systemctl status udp_speeder.socket
journalctl -f -u udp_speeder.socket -u udp_speeder.service

# Start test server without speederv2 (will be started by udp_speeder.socket)
python3 ${UDP_SPEEDER_REPO}/test/udp_speeder_test.py    \
    --mode server                                       \
    --no-udpspeeder                                     \
    --log-level info

# Start client