TSAN error in node.peers test (#2353)

This commit is contained in:
Wesley Shillingford 2019-10-18 11:47:43 +01:00 committed by GitHub
commit 79b38a3a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View file

@ -52,10 +52,7 @@ disconnect_observer ([]() {})
nano::network::~network ()
{
for (auto & thread : packet_processing_threads)
{
thread.join ();
}
stop ();
}
void nano::network::start ()
@ -75,10 +72,17 @@ void nano::network::start ()
void nano::network::stop ()
{
udp_channels.stop ();
tcp_channels.stop ();
resolver.cancel ();
buffer_container.stop ();
if (!stopped.exchange (true))
{
udp_channels.stop ();
tcp_channels.stop ();
resolver.cancel ();
buffer_container.stop ();
for (auto & thread : packet_processing_threads)
{
thread.join ();
}
}
}
void nano::network::send_keepalive (std::shared_ptr<nano::transport::channel> channel_a)

View file

@ -161,6 +161,7 @@ public:
std::function<void()> disconnect_observer;
// Called when a new channel is observed
std::function<void(std::shared_ptr<nano::transport::channel>)> channel_observer;
std::atomic<bool> stopped{ false };
static unsigned const broadcast_interval_ms = 10;
static size_t const buffer_size = 512;
static size_t const confirm_req_hashes_max = 7;