Commit 0ae125e9 authored by Dominik Charousset's avatar Dominik Charousset

Fix possible segfault in new_connection

parent f2d26fdf
......@@ -248,6 +248,12 @@ asio_multiplexer::add_tcp_doorman(abstract_broker* self,
}
bool new_connection() override {
CAF_LOG_TRACE("");
if (detached())
// we are already disconnected from the broker while the multiplexer
// did not yet remove the socket, this can happen if an I/O event causes
// the broker to call close_all() while the pollset contained
// further activities for the broker
return false;
auto& am = acceptor_.backend();
auto x = am.add_tcp_scribe(parent(),
std::move(acceptor_.accepted_socket()));
......
......@@ -811,6 +811,12 @@ accept_handle default_multiplexer::add_tcp_doorman(abstract_broker* self,
}
bool new_connection() override {
CAF_LOG_TRACE("");
if (detached())
// we are already disconnected from the broker while the multiplexer
// did not yet remove the socket, this can happen if an I/O event causes
// the broker to call close_all() while the pollset contained
// further activities for the broker
return false;
auto& dm = acceptor_.backend();
auto hdl = dm.add_tcp_scribe(parent(),
std::move(acceptor_.accepted_socket()));
......
......@@ -47,12 +47,6 @@ void doorman::io_failure(execution_unit* ctx, network::operation op) {
}
bool doorman::new_connection(execution_unit* ctx, connection_handle x) {
if (detached())
// we are already disconnected from the broker while the multiplexer
// did not yet remove the socket, this can happen if an I/O event causes
// the broker to call close_all() while the pollset contained
// further activities for the broker
return false;
msg().handle = x;
return invoke_mailbox_element(ctx);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment