MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / Stop

Method Stop

include/server/server.hpp:132–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 }
131
132 void Stop()
133 {
134 auto stop_promise = std::make_shared<std::promise<void>>();
135 auto stop_future = stop_promise->get_future();
136
137 // Posting the close to the acceptors strand ensures
138 // we do not have a race condition with async_accept.
139 boost::asio::post(acceptor.get_executor(),
140 [self = shared_from_this(), stop_promise]()
141 {
142 boost::beast::error_code ec;
143 (void)self->acceptor.close(ec);
144 if (ec)
145 {
146 util::Log(logDEBUG) << "Error closing acceptor: " << ec.message();
147 }
148 // Stop the io_context
149 self->io_context.stop();
150 stop_promise->set_value();
151 });
152
153 // The above function is async, this simply waits until it succeeded
154 stop_future.wait();
155 }
156
157 void RegisterServiceHandler(std::unique_ptr<ServiceHandlerInterface> service_handler_)
158 {

Callers 1

mainFunction · 0.80

Calls 4

LogClass · 0.85
messageMethod · 0.80
set_valueMethod · 0.80
waitMethod · 0.80

Tested by

no test coverage detected