diff options
| author | Pieter Wuille <[email protected]> | 2012-02-12 13:45:24 +0100 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2012-05-04 16:12:23 +0200 |
| commit | 39857190dee3ed296112cfcfd79b0a375143b6c6 (patch) | |
| tree | c78b110e9731a9b495074e3889b5767ab8d40e8b /src/main.cpp | |
| parent | Add -seednode connections, and use this for -dnsseed + -proxydns (diff) | |
| download | discoin-39857190dee3ed296112cfcfd79b0a375143b6c6.tar.xz discoin-39857190dee3ed296112cfcfd79b0a375143b6c6.zip | |
Support for multiple local addresses
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index 6a3cbe710..b5d8f8f27 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2232,6 +2232,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (!vRecv.empty()) vRecv >> pfrom->nStartingHeight; + if (pfrom->fInbound && addrMe.IsRoutable()) + { + pfrom->addrLocal = addrMe; + SeenLocal(addrMe); + } + // Disconnect if we connected to ourself if (nNonce == nLocalHostNonce && nNonce > 1) { @@ -2255,12 +2261,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (!pfrom->fInbound) { // Advertise our address - if (!fNoListen && !fUseProxy && addrLocalHost.IsRoutable() && - !IsInitialBlockDownload()) + if (!fNoListen && !fUseProxy && !IsInitialBlockDownload()) { - CAddress addr(addrLocalHost); - addr.nTime = GetAdjustedTime(); - pfrom->PushAddress(addr); + CAddress addr = GetLocalAddress(&pfrom->addr); + if (addr.IsRoutable()) + pfrom->PushAddress(addr); } // Get recent addresses @@ -2889,11 +2894,11 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pnode->setAddrKnown.clear(); // Rebroadcast our address - if (!fNoListen && !fUseProxy && addrLocalHost.IsRoutable()) + if (!fNoListen && !fUseProxy) { - CAddress addr(addrLocalHost); - addr.nTime = GetAdjustedTime(); - pnode->PushAddress(addr); + CAddress addr = GetLocalAddress(&pnode->addr); + if (addr.IsRoutable()) + pnode->PushAddress(addr); } } } |