Skip to content
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

edited: Example locks daemon wrapper and service_handler never called #5

Open
noahhai opened this issue Oct 20, 2017 · 0 comments
Open

Comments

@noahhai
Copy link

noahhai commented Oct 20, 2017

Able to get a service installed and started with your example but does not react to stop or restart. I'm wondering if something like StartServiceCtrlDispatcherW is failing, and we're falling through to daemon_console from daemon_service? Any ideas, or anyone solved this?

I first realized the daemon.name has to match the service name exactly for the lookup to work, but fixing that did not fix this.

After testing determined what is failing when trying to run example; the DaemonWrapper executes daemon.holder.exec().unwrap(); in service_main, which calls Receiver.iter in a blocking loop. service_main thus never returns and service_handler can never receive invocation by system to handle stop or shutdown control signals.

To get this working, executing the daemon.holder.exec function in a new thread. When service_handler receives SERVICE_STOP_PENDING control message it gives the receiver some time to clean up and stop, and then sets the status to SERVICE_STOPPED. Is there a better way to do this?

@noahhai noahhai changed the title Not respond to stop/restart on windows 10 edited: Example locks daemon wrapper and service_handler never called Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant