Fix bootstrap_exited segfault on macos (#2510)
This commit is contained in:
parent
5ed4ce1c7c
commit
80f94636a4
1 changed files with 5 additions and 10 deletions
|
@ -877,18 +877,13 @@ TEST (websocket, bootstrap_exited)
|
|||
|
||||
// Start bootstrap, exit after subscription
|
||||
std::atomic<bool> bootstrap_started{ false };
|
||||
std::atomic<bool> subscribed{ false };
|
||||
std::thread bootstrap_thread ([node1, &bootstrap_started, &subscribed]() {
|
||||
nano::util::counted_completion subscribed_completion (1);
|
||||
std::thread bootstrap_thread ([node1, &bootstrap_started, &subscribed_completion]() {
|
||||
node1->bootstrap_initiator.bootstrap (true, "123abc");
|
||||
auto attempt (node1->bootstrap_initiator.current_attempt ());
|
||||
ASSERT_NE (nullptr, attempt);
|
||||
bootstrap_started = true;
|
||||
nano::system system2;
|
||||
system2.deadline_set (5s);
|
||||
while (!subscribed)
|
||||
{
|
||||
ASSERT_NO_ERROR (system2.poll ());
|
||||
}
|
||||
ASSERT_FALSE (subscribed_completion.await_count_for (5s));
|
||||
});
|
||||
|
||||
// Wait for bootstrap start
|
||||
|
@ -915,7 +910,7 @@ TEST (websocket, bootstrap_exited)
|
|||
ASSERT_EQ (1, node1->websocket_server->subscriber_count (nano::websocket::topic::bootstrap));
|
||||
|
||||
// Wait for the bootstrap notification
|
||||
subscribed = true;
|
||||
subscribed_completion.increment ();
|
||||
bootstrap_thread.join ();
|
||||
system.deadline_set (5s);
|
||||
while (client_future.wait_for (std::chrono::seconds (0)) != std::future_status::ready)
|
||||
|
@ -959,4 +954,4 @@ TEST (websocket, ws_keepalive)
|
|||
ASSERT_NO_ERROR (system.poll ());
|
||||
}
|
||||
subscription_thread.join ();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue