Skip to content

Commit

Permalink
Make nServices atomic
Browse files Browse the repository at this point in the history
zcash: cherry picked from commit 0f31872
zcash: bitcoin/bitcoin#9708
  • Loading branch information
TheBlueMatt authored and str4d committed Apr 1, 2021
1 parent 651c46a commit 676e781
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5718,7 +5718,9 @@ bool static ProcessMessage(const CChainParams& chainparams, CNode* pfrom, string
CAddress addrMe;
CAddress addrFrom;
uint64_t nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
uint64_t nServices;
vRecv >> pfrom->nVersion >> nServices >> nTime >> addrMe;
pfrom->nServices = nServices;
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
{
// disconnect from peers older than this proto version
Expand Down
2 changes: 1 addition & 1 deletion src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class CNode
{
public:
// socket
uint64_t nServices;
std::atomic<uint64_t> nServices;
SOCKET hSocket;
CDataStream ssSend;
std::string strSendCommand; // Current command being assembled in ssSend
Expand Down

0 comments on commit 676e781

Please sign in to comment.