]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/shared/bus-unit-util.c
core: add new "PollLimit" settings to .socket units
authorLennart Poettering <lennart@poettering.net>
Sat, 9 Sep 2023 12:46:32 +0000 (14:46 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 18 Sep 2023 16:55:19 +0000 (18:55 +0200)
commit2bec84e7a5bf3687ae65205753ba3d8067cf2f0e
tree64de87add830061a5bafa3e5c8f541b3c75f515d
parent8fbf0a214e2fe474655b17a4b663122943b55db0
core: add new "PollLimit" settings to .socket units

This adds a new "PollLimit" pair of settings to .socket units, very
similar to existing "TriggerLimit" logic. The differences are:

* PollLimit focusses on the polling on the sockets, and pauses that
  temporarily if a ratelimit on that is reached. TriggerLimit otoh
  focusses on the triggering effect of socket units, and stops
  triggering once the ratelimit is hit.

* While the trigger limit being hit is an action that causes the socket
  unit to fail the polling limit being reached will just temporarily
  disable polling on the socket fd, and it is resumed once the ratelimit
  interval is over.

* When a socket unit operates on multiple socket fds (e,g, ListenStream=
  on both some ipv6 and an ipv4 address or so). Then the PollLimit will
  be specific to each fd, while the trigger limit is specific to the
  whole unit.

Implementation-wise this is mostly a wrapper around sd-event's
sd_event_source_set_ratelimit(), which exposes the desired behaviour
directly.

Usecase for all of this: socket services which when overloaded with
connections should just slow down reception of it, but not fail
persistently.
man/org.freedesktop.systemd1.xml
src/core/dbus-socket.c
src/core/load-fragment-gperf.gperf.in
src/core/socket.c
src/core/socket.h
src/shared/bus-unit-util.c