varlink / rust

Rust implementation of the Varlink protocol

Home Page:https://docs.rs/varlink/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide listen() variant that accepts listener

Natureshadow opened this issue · comments

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.

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.