]> git.ipfire.org Git - thirdparty/systemd.git/commit
socket: always pass socket, fd and SocketPeer ownership to service together
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Nov 2021 22:50:07 +0000 (23:50 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Nov 2021 23:05:03 +0000 (00:05 +0100)
commit3fabebf45e268a0e1e8f9e7688b2428f8ee8a802
tree3eed8316178cfe930d06061c66239a0329466406
parentbc6b326d48c245ea4b5033012574da89df933f4a
socket: always pass socket, fd and SocketPeer ownership to service together

Per-connection socket instances we currently maintain three fields
related to the socket: a reference to the Socket unit, the connection fd,
and a reference to the SocketPeer object that counts socket peers.

Let's synchronize their lifetime, i.e. always set them all three
together or unset them together, so that their reference counters stay
synchronous.

THis will in particuar ensure that we'll drop the SocketPeer reference
whenever we leave an active state of the service unit, i.e. at the same
time we close the fd for it.

Fixes: #20685
src/core/service.c
src/core/service.h
src/core/socket.c