aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-02-12 13:45:24 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2012-05-04 16:12:23 +0200
commit39857190dee3ed296112cfcfd79b0a375143b6c6 (patch)
treec78b110e9731a9b495074e3889b5767ab8d40e8b /src/main.cpp
parent478b01d9a797f3ea41cca141992b161867a5996d (diff)
Support for multiple local addresses
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6a3cbe710d..b5d8f8f270 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);
}
}
}