-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for socket activation #111
Conversation
If nsncd is started using socket activation, use the passed FD instead of manually binding on SOCKET_PATH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some comments in line. Have you tested it locally with socket activation yet?
// else bind manually on SOCKET_PATH. | ||
let (listener, listen_address) = match ListenFd::from_env() | ||
.take_unix_listener(0) | ||
.expect("invalid socket type at index") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes slightly more sense to log an error and exit here but I don't feel strongly about it.
{ | ||
Some(listener) => (listener, "sd-listen-unix"), | ||
None => { | ||
let path = Path::new(SOCKET_PATH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's throw this in a fn
I did check it actually starting up, via
I wrote some spam to it, pointing curl to it, and (successfully) got back an error about the wrong protocol version:
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 systemd/systemd#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.