[WIP] Systemd socket activation
I'm submitting this early for feedback in case you aren't interested in maintaining/accepting this feature.
This PR implements systemd socket activation support (WIP). It makes it possible to auto-start rqbit (via systemd) when the user opens the webui, connects to the API, etc.
Implementation wise, this patch simply checks if the process has been passed a file descriptor by systemd and, if so, it uses that file descriptor as the API socket instead of opening a new one. This change doesn't add any new dependencies.
The main remaining TODO item is to implement a way to create a "dual stack" TcpListener from a file descriptor (requiring changes to https://github.com/ikatson/librqbit-dualstack-sockets).
The unit files (in the new systemd directory) are provided for documentation purposes and will likely need to be modified by the end-user (I'll add a README to the systemd directory later).
The PR to librqbit-dualstack-sockets is up: https://github.com/ikatson/librqbit-dualstack-sockets/pull/3
I've tested this locally against https://github.com/ikatson/librqbit-dualstack-sockets/pull/3 and it works.
@ikatson when you get a chance, could you update librqbit-dualstack-sockets in librqbit-utp? That'll let me use that here and move this PR forward.
done and published utp 0.7.0
This should now be ready:
- I put the documentation in the README itself.
- I removed the
.pathunit, but I'm happy to add some text to the readme describing how to auto-activate rqbit when.torrentfiles appear in their~/Downloaddirectory.