diff --git a/src/net.h b/src/net.h index 504855c3863bbb..68f0c051559998 100644 --- a/src/net.h +++ b/src/net.h @@ -995,8 +995,8 @@ class CNode std::vector vAddrToSend; std::unique_ptr m_addr_known{nullptr}; bool fGetAddr{false}; - std::chrono::microseconds m_next_addr_send GUARDED_BY(cs_sendProcessing){0}; - std::chrono::microseconds m_next_local_addr_send GUARDED_BY(cs_sendProcessing){0}; + std::atomic m_next_addr_send{std::chrono::microseconds{0}}; + std::atomic m_next_local_addr_send{std::chrono::microseconds{0}}; // List of block ids we still have announce. // There is no final sorting before sending, as they are always sent immediately diff --git a/src/net_processing.cpp b/src/net_processing.cpp index cdddde854074e0..f850042b53b57e 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4060,14 +4060,14 @@ bool PeerManager::SendMessages(CNode* pto) // Address refresh broadcast auto current_time = GetTime(); - if (pto->RelayAddrsWithConn() && !::ChainstateActive().IsInitialBlockDownload() && pto->m_next_local_addr_send < current_time) { + if (pto->RelayAddrsWithConn() && !::ChainstateActive().IsInitialBlockDownload() && pto->m_next_local_addr_send.load` < current_time) { // If we've sent before, clear the bloom filter for the peer, so that our // self-announcement will actually go out. // This might be unnecessary if the bloom filter has already rolled // over since our last self-announcement, but there is only a small // bandwidth cost that we can incur by doing this (which happens // once a day on average). - if (pto->m_next_local_addr_send != 0us) { + if (pto->m_next_local_addr_send.load != 0us) { pto->m_addr_known->reset(); } AdvertiseLocal(pto); @@ -4077,7 +4077,7 @@ bool PeerManager::SendMessages(CNode* pto) // // Message: addr // - if (pto->RelayAddrsWithConn() && pto->m_next_addr_send < current_time) { + if (pto->RelayAddrsWithConn() && pto->m_next_addr_send.load() < current_time) { pto->m_next_addr_send = PoissonNextSend(current_time, AVG_ADDRESS_BROADCAST_INTERVAL); std::vector vAddr; vAddr.reserve(pto->vAddrToSend.size());