summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-14 01:38:37 +0200
committerCarl Hetherington <cth@carlh.net>2024-06-23 19:51:28 +0200
commit6cdae64ba9ce3a9f02f3a7437cfff078d942cba1 (patch)
tree0125df06d05856a5742bf17dff4c8e65b91733fb
parent8ffb8e7cbc152ce2ce188b108e89309cec5f09a0 (diff)
Do everything required to stop the server in ::stop().
-rw-r--r--src/lib/server.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/server.cc b/src/lib/server.cc
index c1be5735e..6e3781dca 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -41,13 +41,7 @@ Server::Server (int port, int timeout)
Server::~Server ()
{
- {
- boost::mutex::scoped_lock lm (_mutex);
- _terminate = true;
- }
-
- _acceptor.close ();
- stop ();
+ stop();
}
@@ -89,5 +83,11 @@ Server::handle_accept (shared_ptr<Socket> socket, boost::system::error_code cons
void
Server::stop ()
{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _terminate = true;
+ }
+
+ _acceptor.close ();
_io_service.stop ();
}