aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2017-01-18 18:15:00 -0500
committerCory Fields <cory-nospam-@coryfields.com>2017-02-02 16:13:52 -0500
commit2046617b5e06ddb7f960b28219c155995542f029 (patch)
tree53a62fc8ab3fc3361f026f7c1f6429d0456a5887 /src/net.h
parent80ff0344aebbdebdfa7433d855b0aa9de6c4bed3 (diff)
net: deserialize the entire version message locally
This avoids having some vars set if the version negotiation fails. Also copy it all into CNode at the same site. nVersion and fSuccessfullyConnected are set last, as they are the gates for the other vars. Make them atomic for that reason.
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net.h b/src/net.h
index 0b8efcc882..c51ae5a18d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -627,7 +627,7 @@ public:
const CAddress addr;
std::string addrName;
CService addrLocal;
- int nVersion;
+ std::atomic<int> nVersion;
// strSubVer is whatever byte array we read from the wire. However, this field is intended
// to be printed out, displayed to humans in various forms and so on. So we sanitize it and
// store the sanitized version in cleanSubVer. The original should be used when dealing with
@@ -639,7 +639,7 @@ public:
bool fAddnode;
bool fClient;
const bool fInbound;
- bool fSuccessfullyConnected;
+ std::atomic_bool fSuccessfullyConnected;
std::atomic_bool fDisconnect;
// We use fRelayTxes for two purposes -
// a) it allows us to not relay tx invs before receiving the peer's version message