summaryrefslogtreecommitdiff
path: root/src/lib/server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-14 19:50:41 +0200
committerCarl Hetherington <cth@carlh.net>2024-06-23 19:51:28 +0200
commit321380eeb8a9ba4853a982558c9076d26aafdf82 (patch)
tree0a45b630eae75647569bab34b858e0513898a60f /src/lib/server.cc
parentdbab45a8358d8a48043718872f2649fc24b1d9ef (diff)
Close socket when stopping the server.
Otherwise if we're calling e.g. Socket::run() the server's run() will not terminate on stop().
Diffstat (limited to 'src/lib/server.cc')
-rw-r--r--src/lib/server.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 6e3781dca..359234044 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -75,6 +75,8 @@ Server::handle_accept (shared_ptr<Socket> socket, boost::system::error_code cons
return;
}
+ _socket = socket;
+
handle (socket);
start_accept ();
}
@@ -89,5 +91,8 @@ Server::stop ()
}
_acceptor.close ();
+ if (auto s = _socket.lock()) {
+ s->close();
+ }
_io_service.stop ();
}