Closed flokli closed 4 months ago
Looks good, some comments in line. Have you tested it locally with socket activation yet?
I did check it actually starting up, via systemd-socket-activate
:
❯ systemd-socket-activate -l /tmp/foobar.sock target/debug/nsncd
Listening on /tmp/foobar.sock as 3.
Communication attempt on fd 3.
Execing target/debug/nsncd (target/debug/nsncd)
I wrote some spam to it, pointing curl to it, and (successfully) got back an error about the wrong protocol version:
May 08 11:43:02.917 DEBG accepted connection, stream: UnixStream { fd: FileDesc(OwnedFd { fd: 4 }), local: "/tmp/foobar.sock" (pathname), peer: (unnamed) }, thread: worker_2
May 08 11:43:02.917 DEBG parsing request, err: wrong protocol version 542393671, thread: worker_2
I have some systemd config to wire it up there, but I ran into some unrelated other issues and didn't get to fully test it yet. I will, happy to mark it as draft until then.
Shelving these efforts for now, let's revisit this once https://github.com/systemd/systemd/pull/30360 has landed in a release, as it'd probably be revisited after that anyways.
If nsncd is started using socket activation, use the passed FD instead of manually binding on SOCKET_PATH.
This doesn't change any current behaviour in the currently documented startup mode, but makes nsncd fit to run in a socket-activated environment.