--- a/trb e56875060ce8fd2d41c96a063ce8a21eaa93662090730a47fb25c0f7d4cde3928eb6f9008e53807ff6b99454d7bf20d340fb3eba9b3e3b589dcd31dbf6ff0997 +++ b/trb ceeabdd87dc5b231d0eea4498e8ba2b108768e76f7e97459ca5c83573d205fae194629787c701ecd59a7b4c72771820c79c7aedea1875f77b9ac50174f1c0c92 @@ -3384,7 +3384,7 @@ BOOST_AUTO_TEST_SUITE_END() ############################################################################## -2361 @ ./bitcoin/src/makefile.linux-mingw +2211 @ ./bitcoin/src/makefile.linux-mingw ############################################################################## # Copyright (c) 2009-2010 Satoshi Nakamoto # Distributed under the MIT/X11 software license, see the accompanying @@ -3392,8 +3392,6 @@ DEPSDIR:=/usr/i586-mingw32msvc -USE_UPNP:=0 - INCLUDEPATHS= \ -I"$(DEPSDIR)/boost_1_47_0" \ -I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \ @@ -3441,11 +3439,6 @@ wallet.h -ifdef USE_UPNP - LIBPATHS += -L"$(DEPSDIR)/miniupnpc" - LIBS += -l miniupnpc -l iphlpapi - DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) -endif LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi @@ -9709,7 +9702,7 @@ #endif ############################################################################## -106736 @ ./bitcoin/src/main.cpp +106667 @ ./bitcoin/src/main.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -9770,11 +9763,6 @@ int nLimitProcessors = 1; int fMinimizeToTray = true; int fMinimizeOnClose = true; -#if USE_UPNP -int fUseUPnP = true; -#else -int fUseUPnP = false; -#endif ////////////////////////////////////////////////////////////////////////////// @@ -13681,7 +13669,7 @@ #endif ############################################################################## -33064 @ ./bitcoin/src/db.cpp +32913 @ ./bitcoin/src/db.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -14612,7 +14600,6 @@ if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose; if (strKey == "fUseProxy") ssValue >> fUseProxy; if (strKey == "addrProxy") ssValue >> addrProxy; - if (fHaveUPnP && strKey == "fUseUPnP") ssValue >> fUseUPnP; } else if (strType == "minversion") { @@ -14635,9 +14622,6 @@ printf("fMinimizeOnClose = %d\n", fMinimizeOnClose); printf("fUseProxy = %d\n", fUseProxy); printf("addrProxy = %s\n", addrProxy.ToString().c_str()); - if (fHaveUPnP) - printf("fUseUPnP = %d\n", fUseUPnP); - // Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc: if (fIsEncrypted && (nFileVersion == 40000 || nFileVersion == 50000)) @@ -15679,7 +15663,7 @@ } ############################################################################## -64744 @ ./bitcoin/src/net.cpp +59687 @ ./bitcoin/src/net.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -15697,12 +15681,6 @@ #include #endif -#ifdef USE_UPNP -#include -#include -#include -#include -#endif using namespace std; using namespace boost; @@ -15712,9 +15690,6 @@ void ThreadMessageHandler2(void* parg); void ThreadSocketHandler2(void* parg); void ThreadOpenConnections2(void* parg); -#ifdef USE_UPNP -void ThreadMapPort2(void* parg); -#endif void ThreadDNSAddressSeed2(void* parg); bool OpenNetworkConnection(const CAddress& addrConnect); @@ -16793,153 +16768,6 @@ -#ifdef USE_UPNP -void ThreadMapPort(void* parg) -{ - IMPLEMENT_RANDOMIZE_STACK(ThreadMapPort(parg)); - try - { - vnThreadsRunning[5]++; - ThreadMapPort2(parg); - vnThreadsRunning[5]--; - } - catch (std::exception& e) { - vnThreadsRunning[5]--; - PrintException(&e, "ThreadMapPort()"); - } catch (...) { - vnThreadsRunning[5]--; - PrintException(NULL, "ThreadMapPort()"); - } - printf("ThreadMapPort exiting\n"); -} - -void ThreadMapPort2(void* parg) -{ - printf("ThreadMapPort started\n"); - - char port[6]; - sprintf(port, "%d", GetListenPort()); - - const char * multicastif = 0; - const char * minissdpdpath = 0; - struct UPNPDev * devlist = 0; - char lanaddr[64]; - -#ifndef UPNPDISCOVER_SUCCESS - /* miniupnpc 1.5 */ - devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); -#else - /* miniupnpc 1.6 */ - int error = 0; - devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); -#endif - - struct UPNPUrls urls; - struct IGDdatas data; - int r; - - r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); - if (r == 1) - { - if (!addrLocalHost.IsRoutable()) - { - char externalIPAddress[40]; - r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress); - if(r != UPNPCOMMAND_SUCCESS) - printf("UPnP: GetExternalIPAddress() returned %d\n", r); - else - { - if(externalIPAddress[0]) - { - printf("UPnP: ExternalIPAddress = %s\n", externalIPAddress); - CAddress addrExternalFromUPnP(externalIPAddress, 0, false, nLocalServices); - if (addrExternalFromUPnP.IsRoutable()) - addrLocalHost = addrExternalFromUPnP; - } - else - printf("UPnP: GetExternalIPAddress failed.\n"); - } - } - - string strDesc = "Bitcoin " + FormatFullVersion(); -#ifndef UPNPDISCOVER_SUCCESS - /* miniupnpc 1.5 */ - r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, - port, port, lanaddr, strDesc.c_str(), "TCP", 0); -#else - /* miniupnpc 1.6 */ - r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, - port, port, lanaddr, strDesc.c_str(), "TCP", 0, "0"); -#endif - - if(r!=UPNPCOMMAND_SUCCESS) - printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", - port, port, lanaddr, r, strupnperror(r)); - else - printf("UPnP Port Mapping successful.\n"); - int i = 1; - loop { - if (fShutdown || !fUseUPnP) - { - r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port, "TCP", 0); - printf("UPNP_DeletePortMapping() returned : %d\n", r); - freeUPNPDevlist(devlist); devlist = 0; - FreeUPNPUrls(&urls); - return; - } - if (i % 600 == 0) // Refresh every 20 minutes - { -#ifndef UPNPDISCOVER_SUCCESS - /* miniupnpc 1.5 */ - r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, - port, port, lanaddr, strDesc.c_str(), "TCP", 0); -#else - /* miniupnpc 1.6 */ - r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, - port, port, lanaddr, strDesc.c_str(), "TCP", 0, "0"); -#endif - - if(r!=UPNPCOMMAND_SUCCESS) - printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", - port, port, lanaddr, r, strupnperror(r)); - else - printf("UPnP Port Mapping successful.\n");; - } - Sleep(2000); - i++; - } - } else { - printf("No valid UPnP IGDs found\n"); - freeUPNPDevlist(devlist); devlist = 0; - if (r != 0) - FreeUPNPUrls(&urls); - loop { - if (fShutdown || !fUseUPnP) - return; - Sleep(2000); - } - } -} - -void MapPort(bool fMapPort) -{ - if (fUseUPnP != fMapPort) - { - fUseUPnP = fMapPort; - WriteSetting("fUseUPnP", fUseUPnP); - } - if (fUseUPnP && vnThreadsRunning[5] < 1) - { - if (!CreateThread(ThreadMapPort, NULL)) - printf("Error: ThreadMapPort(ThreadMapPort) failed\n"); - } -} -#else -void MapPort(bool /* unused fMapPort */) -{ - // Intentionally left blank. -} -#endif @@ -17555,10 +17383,6 @@ if (!CreateThread(ThreadDNSAddressSeed, NULL)) printf("Error: CreateThread(ThreadDNSAddressSeed) failed\n"); - // Map ports with UPnP - if (fHaveUPnP) - MapPort(fUseUPnP); - // Get addresses from IRC and advertise ours if (!CreateThread(ThreadIRCSeed, NULL)) printf("Error: CreateThread(ThreadIRCSeed) failed\n"); @@ -17586,9 +17410,6 @@ nTransactionsUpdated++; int64 nStart = GetTime(); while (vnThreadsRunning[0] > 0 || vnThreadsRunning[1] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0 -#ifdef USE_UPNP - || vnThreadsRunning[5] > 0 -#endif ) { if (GetTime() - nStart > 20) @@ -17600,7 +17421,6 @@ if (vnThreadsRunning[2] > 0) printf("ThreadMessageHandler still running\n"); if (vnThreadsRunning[3] > 0) printf("ThreadBitcoinMiner still running\n"); if (vnThreadsRunning[4] > 0) printf("ThreadRPCServer still running\n"); - if (fHaveUPnP && vnThreadsRunning[5] > 0) printf("ThreadMapPort still running\n"); if (vnThreadsRunning[6] > 0) printf("ThreadDNSAddressSeed still running\n"); while (vnThreadsRunning[2] > 0 || vnThreadsRunning[4] > 0) Sleep(20); @@ -17968,7 +17788,7 @@ #endif ############################################################################## -39994 @ ./bitcoin/src/main.h +39873 @ ./bitcoin/src/main.h ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -18012,11 +17832,6 @@ static const int COINBASE_MATURITY = 100; // Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp. static const int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC -#ifdef USE_UPNP -static const int fHaveUPnP = true; -#else -static const int fHaveUPnP = false; -#endif @@ -18046,7 +17861,6 @@ extern int nLimitProcessors; extern int fMinimizeToTray; extern int fMinimizeOnClose; -extern int fUseUPnP; @@ -21611,14 +21425,12 @@ #endif ############################################################################## -4292 @ ./bitcoin/src/makefile.unix +4150 @ ./bitcoin/src/makefile.unix ############################################################################## # Copyright (c) 2009-2010 Satoshi Nakamoto # Distributed under the MIT/X11 software license, see the accompanying # file license.txt or http://www.opensource.org/licenses/mit-license.php. -USE_UPNP:=0 - DEFS=-DNOPCH DEFS += $(addprefix -I,$(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) @@ -21646,14 +21458,6 @@ -l ssl \ -l crypto -ifndef USE_UPNP - override USE_UPNP = - -endif -ifneq (${USE_UPNP}, -) - LIBS += -l miniupnpc - DEFS += -DUSE_UPNP=$(USE_UPNP) -endif - ifneq (${USE_SSL}, 0) DEFS += -DUSE_SSL endif @@ -21845,7 +21649,7 @@ } ############################################################################## -17577 @ ./bitcoin/src/init.cpp +17101 @ ./bitcoin/src/init.cpp ############################################################################## // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers @@ -22037,13 +21841,6 @@ " -bantime= \t " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)\n") + " -maxreceivebuffer=\t " + _("Maximum per-connection receive buffer, *1000 bytes (default: 10000)\n") + " -maxsendbuffer=\t " + _("Maximum per-connection send buffer, *1000 bytes (default: 10000)\n") + -#ifdef USE_UPNP -#if USE_UPNP - " -noupnp \t " + _("Don't attempt to use UPnP to map the listening port\n") + -#else - " -upnp \t " + _("Attempt to use UPnP to map the listening port\n") + -#endif -#endif " -paytxfee= \t " + _("Fee per kB to add to transactions you send\n") + #if !defined(WIN32) " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + @@ -22309,8 +22106,6 @@ SoftSetArg("-nolisten", true); SoftSetArg("-noirc", true); SoftSetArg("-nodnsseed", true); - SoftSetArg("-noupnp", true); - SoftSetArg("-upnp", false); SoftSetArg("-dns", false); } @@ -22318,10 +22113,6 @@ fNoListen = GetBoolArg("-nolisten"); // Command-line args override in-wallet settings: - if (mapArgs.count("-upnp")) - fUseUPnP = GetBoolArg("-upnp"); - else if (mapArgs.count("-noupnp")) - fUseUPnP = !GetBoolArg("-noupnp"); if (!fNoListen) {