mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-02-05 19:34:16 +00:00
removed UPnP
This commit is contained in:
parent
8660b945ed
commit
68f9750279
@ -64,22 +64,6 @@ contains(USE_QRCODE, 1) {
|
|||||||
LIBS += -lqrencode
|
LIBS += -lqrencode
|
||||||
}
|
}
|
||||||
|
|
||||||
# use: qmake "USE_UPNP=1" ( enabled by default; default)
|
|
||||||
# or: qmake "USE_UPNP=0" (disabled by default)
|
|
||||||
# or: qmake "USE_UPNP=-" (not supported)
|
|
||||||
# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support
|
|
||||||
contains(USE_UPNP, -) {
|
|
||||||
message(Building without UPNP support)
|
|
||||||
} else {
|
|
||||||
message(Building with UPNP support)
|
|
||||||
count(USE_UPNP, 0) {
|
|
||||||
USE_UPNP=1
|
|
||||||
}
|
|
||||||
DEFINES += USE_UPNP=$$USE_UPNP STATICLIB
|
|
||||||
INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH
|
|
||||||
LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc
|
|
||||||
win32:LIBS += -liphlpapi
|
|
||||||
}
|
|
||||||
|
|
||||||
# use: qmake "USE_DBUS=1"
|
# use: qmake "USE_DBUS=1"
|
||||||
contains(USE_DBUS, 1) {
|
contains(USE_DBUS, 1) {
|
||||||
|
17
src/init.cpp
17
src/init.cpp
@ -349,13 +349,6 @@ std::string HelpMessage()
|
|||||||
" -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n" +
|
" -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n" +
|
||||||
" -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n" +
|
" -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n" +
|
||||||
" -bloomfilters " + _("Allow peers to set bloom filters (default: 1)") + "\n" +
|
" -bloomfilters " + _("Allow peers to set bloom filters (default: 1)") + "\n" +
|
||||||
#ifdef USE_UPNP
|
|
||||||
#if USE_UPNP
|
|
||||||
" -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n" +
|
|
||||||
#else
|
|
||||||
" -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n" +
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
" -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n" +
|
" -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n" +
|
||||||
" -mininput=<amt> " + _("When creating transactions, ignore inputs with value less than this (default: 0.0001)") + "\n" +
|
" -mininput=<amt> " + _("When creating transactions, ignore inputs with value less than this (default: 0.0001)") + "\n" +
|
||||||
#ifdef QT_GUI
|
#ifdef QT_GUI
|
||||||
@ -600,7 +593,6 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
|
|
||||||
if (!GetBoolArg("-listen", true)) {
|
if (!GetBoolArg("-listen", true)) {
|
||||||
// do not map ports or try to retrieve public IP when not listening (pointless)
|
// do not map ports or try to retrieve public IP when not listening (pointless)
|
||||||
SoftSetBoolArg("-upnp", false);
|
|
||||||
SoftSetBoolArg("-discover", false);
|
SoftSetBoolArg("-discover", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,10 +800,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
enum Network net = ParseNetwork(snet);
|
enum Network net = ParseNetwork(snet);
|
||||||
if (net == NET_NATIVE_I2P)
|
if (net == NET_NATIVE_I2P)
|
||||||
{
|
{
|
||||||
// Disable upnp and listen on I2P only.
|
// listen on I2P only.
|
||||||
#ifdef USE_UPNP
|
|
||||||
SoftSetBoolArg("-upnp", false);
|
|
||||||
#endif
|
|
||||||
SoftSetBoolArg("-listen",true);
|
SoftSetBoolArg("-listen",true);
|
||||||
SoftSetBoolArg("-discover",false);
|
SoftSetBoolArg("-discover",false);
|
||||||
}
|
}
|
||||||
@ -859,10 +848,6 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
// -i2p can override both tor and proxy
|
// -i2p can override both tor and proxy
|
||||||
if (!(mapArgs.count("-i2p") && mapArgs["-i2p"] == "0") || IsI2POnly())
|
if (!(mapArgs.count("-i2p") && mapArgs["-i2p"] == "0") || IsI2POnly())
|
||||||
{
|
{
|
||||||
// Disable on i2p per default
|
|
||||||
#ifdef USE_UPNP
|
|
||||||
SoftSetBoolArg("-upnp", false);
|
|
||||||
#endif
|
|
||||||
SoftSetBoolArg("-listen",true);
|
SoftSetBoolArg("-listen",true);
|
||||||
SetReachable(NET_NATIVE_I2P);
|
SetReachable(NET_NATIVE_I2P);
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,6 @@ static const int COINBASE_MATURITY = 100;
|
|||||||
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
|
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
|
||||||
/** Maximum number of script-checking threads allowed */
|
/** Maximum number of script-checking threads allowed */
|
||||||
static const int MAX_SCRIPTCHECK_THREADS = 16;
|
static const int MAX_SCRIPTCHECK_THREADS = 16;
|
||||||
#ifdef USE_UPNP
|
|
||||||
static const int fHaveUPnP = true;
|
|
||||||
#else
|
|
||||||
static const int fHaveUPnP = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern CScript COINBASE_FLAGS;
|
extern CScript COINBASE_FLAGS;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
|
|
||||||
USE_UPNP:=-
|
|
||||||
USE_IPV6:=1
|
USE_IPV6:=1
|
||||||
USE_DEBUG:=no
|
USE_DEBUG:=no
|
||||||
|
|
||||||
@ -59,13 +58,6 @@ LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -Wl,-Bstatic
|
|||||||
|
|
||||||
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
|
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
|
||||||
|
|
||||||
ifndef USE_UPNP
|
|
||||||
override USE_UPNP = -
|
|
||||||
endif
|
|
||||||
ifneq (${USE_UPNP}, -)
|
|
||||||
LIBS += -l miniupnpc -l iphlpapi
|
|
||||||
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq (${USE_IPV6}, -)
|
ifneq (${USE_IPV6}, -)
|
||||||
DEFS += -DUSE_IPV6=$(USE_IPV6)
|
DEFS += -DUSE_IPV6=$(USE_IPV6)
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
# Distributed under the MIT/X11 software license, see the accompanying
|
# Distributed under the MIT/X11 software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
# :=0 --> UPnP support turned off by default at runtime
|
|
||||||
# :=1 --> UPnP support turned on by default at runtime
|
|
||||||
# :=- --> No UPnP support - miniupnp not required
|
|
||||||
USE_UPNP:=0
|
|
||||||
|
|
||||||
# :=1 --> Enable IPv6 support
|
# :=1 --> Enable IPv6 support
|
||||||
# :=0 --> Disable IPv6 support
|
# :=0 --> Disable IPv6 support
|
||||||
USE_IPV6:=1
|
USE_IPV6:=1
|
||||||
@ -46,14 +41,6 @@ TESTLIBS += \
|
|||||||
-Wl,-B$(LMODE) \
|
-Wl,-B$(LMODE) \
|
||||||
-l boost_unit_test_framework$(BOOST_LIB_SUFFIX)
|
-l boost_unit_test_framework$(BOOST_LIB_SUFFIX)
|
||||||
|
|
||||||
ifndef USE_UPNP
|
|
||||||
override USE_UPNP = -
|
|
||||||
endif
|
|
||||||
ifneq (${USE_UPNP}, -)
|
|
||||||
LIBS += -l miniupnpc
|
|
||||||
DEFS += -DUSE_UPNP=$(USE_UPNP)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq (${USE_IPV6}, -)
|
ifneq (${USE_IPV6}, -)
|
||||||
DEFS += -DUSE_IPV6=$(USE_IPV6)
|
DEFS += -DUSE_IPV6=$(USE_IPV6)
|
||||||
endif
|
endif
|
||||||
|
127
src/net.cpp
127
src/net.cpp
@ -15,13 +15,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
|
||||||
#include <miniupnpc/miniwget.h>
|
|
||||||
#include <miniupnpc/miniupnpc.h>
|
|
||||||
#include <miniupnpc/upnpcommands.h>
|
|
||||||
#include <miniupnpc/upnperrors.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Dump addresses to peers.dat every 15 minutes (900s)
|
// Dump addresses to peers.dat every 15 minutes (900s)
|
||||||
#define DUMP_ADDRESSES_INTERVAL 900
|
#define DUMP_ADDRESSES_INTERVAL 900
|
||||||
@ -1229,120 +1222,6 @@ void ThreadSocketHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
|
||||||
void ThreadMapPort()
|
|
||||||
{
|
|
||||||
std::string port = strprintf("%u", 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;
|
|
||||||
#ifdef WIN32
|
|
||||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error);
|
|
||||||
#else
|
|
||||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct UPNPUrls urls;
|
|
||||||
struct IGDdatas data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
|
|
||||||
if (r == 1)
|
|
||||||
{
|
|
||||||
if (fDiscover) {
|
|
||||||
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);
|
|
||||||
AddLocal(CNetAddr(externalIPAddress), LOCAL_UPNP);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("UPnP: GetExternalIPAddress failed.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string strDesc = "Gostcoin " + FormatFullVersion();
|
|
||||||
|
|
||||||
try {
|
|
||||||
loop {
|
|
||||||
#ifndef UPNPDISCOVER_SUCCESS
|
|
||||||
/* miniupnpc 1.5 */
|
|
||||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
|
||||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
|
|
||||||
#else
|
|
||||||
/* miniupnpc 1.6 */
|
|
||||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
|
||||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(r!=UPNPCOMMAND_SUCCESS)
|
|
||||||
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
|
||||||
port.c_str(), port.c_str(), lanaddr, r, strupnperror(r));
|
|
||||||
else
|
|
||||||
printf("UPnP Port Mapping successful.\n");;
|
|
||||||
|
|
||||||
MilliSleep(20*60*1000); // Refresh every 20 minutes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (boost::thread_interrupted)
|
|
||||||
{
|
|
||||||
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
|
|
||||||
printf("UPNP_DeletePortMapping() returned : %d\n", r);
|
|
||||||
freeUPNPDevlist(devlist); devlist = 0;
|
|
||||||
FreeUPNPUrls(&urls);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("No valid UPnP IGDs found\n");
|
|
||||||
freeUPNPDevlist(devlist); devlist = 0;
|
|
||||||
if (r != 0)
|
|
||||||
FreeUPNPUrls(&urls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapPort(bool fUseUPnP)
|
|
||||||
{
|
|
||||||
static boost::thread* upnp_thread = NULL;
|
|
||||||
|
|
||||||
if (fUseUPnP)
|
|
||||||
{
|
|
||||||
if (upnp_thread) {
|
|
||||||
upnp_thread->interrupt();
|
|
||||||
upnp_thread->join();
|
|
||||||
delete upnp_thread;
|
|
||||||
}
|
|
||||||
upnp_thread = new boost::thread(boost::bind(&TraceThread<boost::function<void()> >, "upnp", &ThreadMapPort));
|
|
||||||
}
|
|
||||||
else if (upnp_thread) {
|
|
||||||
upnp_thread->interrupt();
|
|
||||||
upnp_thread->join();
|
|
||||||
delete upnp_thread;
|
|
||||||
upnp_thread = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
void MapPort(bool)
|
|
||||||
{
|
|
||||||
// Intentionally left blank.
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *strI2PDNSSeed[][2] = {
|
static const char *strI2PDNSSeed[][2] = {
|
||||||
/*{"cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p","cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p"} // xcps*/
|
/*{"cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p","cxlrsrjc7kwcoqm6mnhsrjw6pkglt5hk5q5ctrullz5wyhfv2ylq.b32.i2p"} // xcps*/
|
||||||
{"6kpijk3ykvn7yqloxmkmudoow326dubsrzrxqbkwstrxb73z4auq.b32.i2p","6kpijk3ykvn7yqloxmkmudoow326dubsrzrxqbkwstrxb73z4auq.b32.i2p"} // R4SAS
|
{"6kpijk3ykvn7yqloxmkmudoow326dubsrzrxqbkwstrxb73z4auq.b32.i2p","6kpijk3ykvn7yqloxmkmudoow326dubsrzrxqbkwstrxb73z4auq.b32.i2p"} // R4SAS
|
||||||
@ -1984,11 +1863,6 @@ void StartNode(boost::thread_group& threadGroup)
|
|||||||
else
|
else
|
||||||
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "dnsseed", &ThreadDNSAddressSeed));
|
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "dnsseed", &ThreadDNSAddressSeed));
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
|
||||||
// Map ports with UPnP
|
|
||||||
MapPort(GetBoolArg("-upnp", USE_UPNP));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Send and receive from sockets, accept connections
|
// Send and receive from sockets, accept connections
|
||||||
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "net", &ThreadSocketHandler));
|
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "net", &ThreadSocketHandler));
|
||||||
|
|
||||||
@ -2009,7 +1883,6 @@ bool StopNode()
|
|||||||
{
|
{
|
||||||
printf("StopNode()\n");
|
printf("StopNode()\n");
|
||||||
GenerateBitcoins(false, NULL);
|
GenerateBitcoins(false, NULL);
|
||||||
MapPort(false);
|
|
||||||
nTransactionsUpdated++;
|
nTransactionsUpdated++;
|
||||||
if (semOutbound)
|
if (semOutbound)
|
||||||
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
|
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
|
||||||
|
@ -38,7 +38,6 @@ void AddressCurrentlyConnected(const CService& addr);
|
|||||||
CNode* FindNode(const CNetAddr& ip);
|
CNode* FindNode(const CNetAddr& ip);
|
||||||
CNode* FindNode(const CService& ip);
|
CNode* FindNode(const CService& ip);
|
||||||
CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL);
|
CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL);
|
||||||
void MapPort(bool fUseUPnP);
|
|
||||||
unsigned short GetListenPort();
|
unsigned short GetListenPort();
|
||||||
bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string()));
|
bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string()));
|
||||||
void StartNode(boost::thread_group& threadGroup);
|
void StartNode(boost::thread_group& threadGroup);
|
||||||
@ -56,8 +55,6 @@ enum
|
|||||||
LOCAL_NONE, // unknown
|
LOCAL_NONE, // unknown
|
||||||
LOCAL_IF, // address a local interface listens on
|
LOCAL_IF, // address a local interface listens on
|
||||||
LOCAL_BIND, // address explicit bound to
|
LOCAL_BIND, // address explicit bound to
|
||||||
LOCAL_UPNP, // address reported by UPnP
|
|
||||||
LOCAL_IRC, // address reported by IRC (deprecated)
|
|
||||||
LOCAL_HTTP, // address reported by whatismyip.com and similar
|
LOCAL_HTTP, // address reported by whatismyip.com and similar
|
||||||
LOCAL_MANUAL, // address explicitly specified (-externalip=)
|
LOCAL_MANUAL, // address explicitly specified (-externalip=)
|
||||||
|
|
||||||
|
@ -195,8 +195,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'")
|
|||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"),
|
QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"),
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"),
|
QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"),
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"),
|
QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"),
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 0)"),
|
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 1 when listening)"),
|
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"),
|
QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"),
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
|
QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
|
||||||
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
|
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
|
||||||
|
@ -112,7 +112,7 @@ This is experimental software.
|
|||||||
|
|
||||||
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</string>
|
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com).</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -136,16 +136,6 @@
|
|||||||
<string>&Network</string>
|
<string>&Network</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_Network">
|
<layout class="QVBoxLayout" name="verticalLayout_Network">
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="mapPortUpnp">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Automatically open the Gostcoin client port on the router. This only works when your router supports UPnP and it is enabled.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Map port using &UPnP</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="connectSocks">
|
<widget class="QCheckBox" name="connectSocks">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -27,9 +27,6 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
/* Network elements init */
|
/* Network elements init */
|
||||||
#ifndef USE_UPNP
|
|
||||||
ui->mapPortUpnp->setEnabled(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ui->proxyIp->setEnabled(false);
|
ui->proxyIp->setEnabled(false);
|
||||||
ui->proxyPort->setEnabled(false);
|
ui->proxyPort->setEnabled(false);
|
||||||
@ -144,8 +141,6 @@ void OptionsDialog::setMapper()
|
|||||||
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
|
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
|
||||||
|
|
||||||
/* Network */
|
/* Network */
|
||||||
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
|
|
||||||
|
|
||||||
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
|
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
|
||||||
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
|
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
|
||||||
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
|
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
|
||||||
|
@ -119,8 +119,6 @@ void OptionsModel::Init()
|
|||||||
|
|
||||||
// These are shared with core Bitcoin; we want
|
// These are shared with core Bitcoin; we want
|
||||||
// command-line options to override the GUI settings:
|
// command-line options to override the GUI settings:
|
||||||
if (settings.contains("fUseUPnP"))
|
|
||||||
SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool());
|
|
||||||
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
|
if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool())
|
||||||
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
|
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
|
||||||
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
|
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
|
||||||
@ -224,7 +222,7 @@ bool OptionsModel::Upgrade()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QList<QString> boolOptions;
|
QList<QString> boolOptions;
|
||||||
boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fSilentMode" << "fMinimizeOnClose" << "fUseProxy" << "fUseUPnP";
|
boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fSilentMode" << "fMinimizeOnClose" << "fUseProxy";
|
||||||
foreach(QString key, boolOptions)
|
foreach(QString key, boolOptions)
|
||||||
{
|
{
|
||||||
bool value = false;
|
bool value = false;
|
||||||
@ -278,12 +276,6 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
|||||||
return QVariant(fMinimizeToTray);
|
return QVariant(fMinimizeToTray);
|
||||||
case SilentMode:
|
case SilentMode:
|
||||||
return QVariant(fSilentMode);
|
return QVariant(fSilentMode);
|
||||||
case MapPortUPnP:
|
|
||||||
#ifdef USE_UPNP
|
|
||||||
return settings.value("fUseUPnP", GetBoolArg("-upnp", true));
|
|
||||||
#else
|
|
||||||
return QVariant(false);
|
|
||||||
#endif
|
|
||||||
case MinimizeOnClose:
|
case MinimizeOnClose:
|
||||||
return QVariant(fMinimizeOnClose);
|
return QVariant(fMinimizeOnClose);
|
||||||
case ProxyUse: {
|
case ProxyUse: {
|
||||||
@ -400,10 +392,6 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
|||||||
fSilentMode = value.toBool();
|
fSilentMode = value.toBool();
|
||||||
settings.setValue("fSilentMode", fSilentMode);
|
settings.setValue("fSilentMode", fSilentMode);
|
||||||
break;
|
break;
|
||||||
case MapPortUPnP:
|
|
||||||
settings.setValue("fUseUPnP", value.toBool());
|
|
||||||
MapPort(value.toBool());
|
|
||||||
break;
|
|
||||||
case MinimizeOnClose:
|
case MinimizeOnClose:
|
||||||
fMinimizeOnClose = value.toBool();
|
fMinimizeOnClose = value.toBool();
|
||||||
settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
|
settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
|
||||||
|
@ -19,7 +19,6 @@ public:
|
|||||||
enum OptionID {
|
enum OptionID {
|
||||||
StartAtStartup, // bool
|
StartAtStartup, // bool
|
||||||
MinimizeToTray, // bool
|
MinimizeToTray, // bool
|
||||||
MapPortUPnP, // bool
|
|
||||||
MinimizeOnClose, // bool
|
MinimizeOnClose, // bool
|
||||||
ProxyUse, // bool
|
ProxyUse, // bool
|
||||||
ProxyIP, // QString
|
ProxyIP, // QString
|
||||||
|
Loading…
x
Reference in New Issue
Block a user