aboutsummaryrefslogtreecommitdiff
path: root/net.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-03-14 09:15:06 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-03-14 09:15:06 -0400
commit27b7f3b43a3868cd4d4f97e03c35074c2ef12349 (patch)
treea39d6207cb612126097f98419dea51e580f5ba35 /net.h
parent4b88647966a1144b5e5532fef50bbf34f9402e71 (diff)
parentcbc920d474b84e8ca339618b1419383000db531f (diff)
Merge branch 'shy'
Diffstat (limited to 'net.h')
-rw-r--r--net.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/net.h b/net.h
index 05ef5e0647..7d4974fd01 100644
--- a/net.h
+++ b/net.h
@@ -572,14 +572,9 @@ public:
fGetAddr = false;
vfSubscribe.assign(256, false);
- // Push a version message
- /// when NTP implemented, change to just nTime = GetAdjustedTime()
- int64 nTime = (fInbound ? GetAdjustedTime() : GetTime());
- CAddress addrYou = (fUseProxy ? CAddress("0.0.0.0") : addr);
- CAddress addrMe = (fUseProxy ? CAddress("0.0.0.0") : addrLocalHost);
- RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
- PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe,
- nLocalHostNonce, string(pszSubVer), nBestHeight);
+ // Be shy and don't send version until we hear
+ if (!fInbound)
+ PushVersion();
}
~CNode()
@@ -736,6 +731,19 @@ public:
+ void PushVersion()
+ {
+ /// when NTP implemented, change to just nTime = GetAdjustedTime()
+ int64 nTime = (fInbound ? GetAdjustedTime() : GetTime());
+ CAddress addrYou = (fUseProxy ? CAddress("0.0.0.0") : addr);
+ CAddress addrMe = (fUseProxy ? CAddress("0.0.0.0") : addrLocalHost);
+ RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
+ PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe,
+ nLocalHostNonce, string(pszSubVer), nBestHeight);
+ }
+
+
+
void PushMessage(const char* pszCommand)
{