rust
rust copied to clipboard
Provide listen() variant that accepts listener
In order to use systemd socket activation, it would be good to provide a variant of listen
that, instead of an address string, accepts a Listener
.
Hmm, reading the code, it seems that passed sockets are silently listened on.
It works fine, just listen on unix:///proc/self/fd/3
.
You can test it using something like: systemd-socket-activate -l /tmp/test.sock -- cargo run
bonus points by using idle timeout to exit when not needed 😁
This issue can be closed.
It works fine, just listen on
unix:///proc/self/fd/3
.
And to find out that the fd is 3, I use a dice ;)?
And to find out that the fd is 3, I use a dice ;)?
It's part of systemd socket activation https://www.freedesktop.org/software/systemd/man/latest/systemd-socket-activate.html
Otherwise, standard input and output will be inherited, and sockets will be passed through file descriptors 3 and higher.