Is served already captured the SIGTERM ?
AppleWeng opened this issue · 4 comments
I want to capture SIGTERM signal. But I found when I USE RestfulServer ,I can't capture the SIGTERM signal. Is served already captured the SIGTERM ?Thank you!
Shouldn't this be an option, or a compile-time feature?
We use served as well in a console, and have commented out the signal captures of served.
The problem with removing the signal handling is that it would break clients that consume the library and rely on the existing behaviour. The library needs to capture signals to shut down gracefully.
One option would be to make shutdown a responsibility of the library user. I can't remember if there was a good reason not to do this, but it might be as simple as turning server::do_await_stop into a destructor to clean up whenever the server object is destroyed. Of course this would break clients that depend on the existing behaviour.
Another option would be to accept an asio::signal_set as a parameter to the server constructor. Multiple handlers can be registered via successive calls to the member function async_await, but this seems pretty clunky to me.
well, at the moment, we work around the issue by implementing the behavior of the server in our own code. works like a charm.