File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed
Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -309,14 +309,14 @@ void server<endpoint>::start_listen(const boost::asio::ip::tcp::endpoint& e,size
309309template <class endpoint >
310310void server<endpoint>::stop_listen(bool join) {
311311 {
312- boost::unique_lock<boost::recursive_mutex> lock (m_endpoint.m_lock );
313-
314- if (m_state != LISTENING) {
315- throw exception (" stop_listen called from invalid state" );
316- }
317-
318- m_acceptor.close ();
319- }
312+ boost::unique_lock<boost::recursive_mutex> lock (m_endpoint.m_lock );
313+
314+ if (m_state != LISTENING) {
315+ throw exception (" stop_listen called from invalid state" );
316+ }
317+
318+ m_acceptor.close ();
319+ }
320320
321321 m_state = STOPPING;
322322
@@ -353,6 +353,13 @@ template <class endpoint>
353353void server<endpoint>::start_accept() {
354354 boost::lock_guard<boost::recursive_mutex> lock (m_endpoint.m_lock );
355355
356+ if (!m_acceptor.is_open ()) {
357+ m_endpoint.m_alog ->at (log::alevel::ENDPOINT)
358+ << " Accept loop is stopping because acceptor was closed."
359+ << log::endl;
360+ return ;
361+ }
362+
356363 connection_ptr con = m_endpoint.create_connection ();
357364
358365 if (con == connection_ptr ()) {
@@ -362,7 +369,7 @@ void server<endpoint>::start_accept() {
362369 << log::endl;
363370 return ;
364371 }
365-
372+
366373 m_acceptor.async_accept (
367374 con->get_raw_socket (),
368375 boost::bind (
You can’t perform that action at this time.
0 commit comments