Commit 84b76bdf authored by Dominik Charousset's avatar Dominik Charousset

Fix deadlock in BASP unit test

parent 7f781560
...@@ -393,7 +393,8 @@ void middleman::stop() { ...@@ -393,7 +393,8 @@ void middleman::stop() {
named_brokers_.clear(); named_brokers_.clear();
scoped_actor self{system(), true}; scoped_actor self{system(), true};
self->send_exit(manager_, exit_reason::kill); self->send_exit(manager_, exit_reason::kill);
self->wait_for(manager_); if (system().config().middleman_detach_utility_actors)
self->wait_for(manager_);
destroy(manager_); destroy(manager_);
} }
......
...@@ -129,7 +129,7 @@ public: ...@@ -129,7 +129,7 @@ public:
: sys(cfg.load<io::middleman, network::test_multiplexer>() : sys(cfg.load<io::middleman, network::test_multiplexer>()
.set("middleman.enable-automatic-connections", autoconn) .set("middleman.enable-automatic-connections", autoconn)
.set("scheduler.policy", autoconn ? caf::atom("testing") .set("scheduler.policy", autoconn ? caf::atom("testing")
: caf::atom("default")) : caf::atom("stealing"))
.set("middleman.detach-utility-actors", !autoconn)) { .set("middleman.detach-utility-actors", !autoconn)) {
auto& mm = sys.middleman(); auto& mm = sys.middleman();
mpx_ = dynamic_cast<network::test_multiplexer*>(&mm.backend()); mpx_ = dynamic_cast<network::test_multiplexer*>(&mm.backend());
...@@ -843,8 +843,10 @@ CAF_TEST(automatic_connection) { ...@@ -843,8 +843,10 @@ CAF_TEST(automatic_connection) {
make_message(uint16_t{8080}, std::move(res)))); make_message(uint16_t{8080}, std::move(res))));
// our connection helper should now connect to jupiter and // our connection helper should now connect to jupiter and
// send the scribe handle over to the BASP broker // send the scribe handle over to the BASP broker
while (mpx()->has_pending_scribe("jupiter", 8080)) while (mpx()->has_pending_scribe("jupiter", 8080)) {
sched.run();
mpx()->flush_runnables(); mpx()->flush_runnables();
}
CAF_REQUIRE(mpx()->output_buffer(mars().connection).empty()); CAF_REQUIRE(mpx()->output_buffer(mars().connection).empty());
// send handshake from jupiter // send handshake from jupiter
mock(jupiter().connection, mock(jupiter().connection,
......
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