Skip to content

Commit 336f346

Browse files
committed
Revert to the previous implementation of server_base::stop to make the
handle_stop method called from the same thread as io_service::run().
1 parent 6597564 commit 336f346

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

webserver/server.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void server_base::run() {
7676

7777
/// Ask the server to stop using asynchronous command
7878
void server_base::stop() {
79-
handle_stop();
79+
// Post a call to the stop function so that server_base::stop() is safe to call from any thread.
80+
io_service_.post(boost::bind(&server_base::handle_stop, this));
8081
}
8182

8283
/// Returns true if the server is stopped.

0 commit comments

Comments
 (0)