diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-12 13:45:24 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-05-04 16:12:23 +0200 |
commit | 39857190dee3ed296112cfcfd79b0a375143b6c6 (patch) | |
tree | c78b110e9731a9b495074e3889b5767ab8d40e8b /src/irc.cpp | |
parent | 478b01d9a797f3ea41cca141992b161867a5996d (diff) |
Support for multiple local addresses
Diffstat (limited to 'src/irc.cpp')
-rw-r--r-- | src/irc.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/irc.cpp b/src/irc.cpp index 237497055d..f20152495e 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -12,7 +12,6 @@ using namespace std; using namespace boost; int nGotIRCAddresses = 0; -bool fGotExternalIP = false; void ThreadIRCSeed2(void* parg); @@ -216,7 +215,6 @@ void ThreadIRCSeed2(void* parg) printf("ThreadIRCSeed started\n"); int nErrorWait = 10; int nRetryWait = 10; - bool fNameInUse = false; while (!fShutdown) { @@ -248,9 +246,10 @@ void ThreadIRCSeed2(void* parg) return; } + CNetAddr addrLocal; string strMyName; - if (addrLocalHost.IsRoutable() && !fUseProxy && !fNameInUse) - strMyName = EncodeAddress(addrLocalHost); + if (GetLocal(addrLocal, &addrConnect)) + strMyName = EncodeAddress(GetLocalAddress(&addrConnect)); else strMyName = strprintf("x%u", GetRand(1000000000)); @@ -265,7 +264,6 @@ void ThreadIRCSeed2(void* parg) if (nRet == 2) { printf("IRC name already in use\n"); - fNameInUse = true; Wait(10); continue; } @@ -285,9 +283,8 @@ void ThreadIRCSeed2(void* parg) if (!fUseProxy && addrFromIRC.IsRoutable()) { // IRC lets you to re-nick - fGotExternalIP = true; - addrLocalHost.SetIP(addrFromIRC); - strMyName = EncodeAddress(addrLocalHost); + AddLocal(addrFromIRC, LOCAL_IRC); + strMyName = EncodeAddress(GetLocalAddress(&addrConnect)); Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str()); } } |