diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2022-07-06 13:58:08 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2022-07-12 13:38:14 -0400 |
commit | e939cf2b7645c2b20a68cb6129f3aebfdf287d61 (patch) | |
tree | b050ed53fa5d72257817e4951f5fde18ec7cad1b /src | |
parent | aeab1b42e67cc8146bfc7d127d15633bd652fe60 (diff) |
Remove atomic for m_last_getheaders_timestamp
This variable is only used in a single thread, so no atomic or mutex is
necessary to guard it.
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index c33dd29923..77fa23b594 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -358,7 +358,7 @@ struct Peer { std::deque<CInv> m_getdata_requests GUARDED_BY(m_getdata_requests_mutex); /** Time of the last getheaders message to this peer */ - std::atomic<NodeClock::time_point> m_last_getheaders_timestamp{NodeSeconds{}}; + NodeClock::time_point m_last_getheaders_timestamp{}; Peer(NodeId id) : m_id{id} @@ -2276,7 +2276,7 @@ bool PeerManagerImpl::MaybeSendGetHeaders(CNode& pfrom, const CBlockLocator& loc // Only allow a new getheaders message to go out if we don't have a recent // one already in-flight - if (current_time - peer.m_last_getheaders_timestamp.load() > HEADERS_RESPONSE_TIME) { + if (current_time - peer.m_last_getheaders_timestamp > HEADERS_RESPONSE_TIME) { m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, locator, uint256())); peer.m_last_getheaders_timestamp = current_time; return true; @@ -3974,7 +3974,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, // Assume that this is in response to any outstanding getheaders // request we may have sent, and clear out the time of our last request - peer->m_last_getheaders_timestamp.store(NodeSeconds{}); + peer->m_last_getheaders_timestamp = {}; std::vector<CBlockHeader> headers; |