diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-01-24 10:42:17 -0500 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-03-05 17:13:07 -0500 |
commit | cbc920d474b84e8ca339618b1419383000db531f (patch) | |
tree | 93dce192d4b7a24046471c3ee1d261205ed09948 /net.h | |
parent | f36b494aebcfe4cc6a45003520ee7d15eeaba8df (diff) |
shy patch from Hal
Diffstat (limited to 'net.h')
-rw-r--r-- | net.h | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -571,14 +571,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() @@ -735,6 +730,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) { |