aboutsummaryrefslogtreecommitdiff
path: root/net.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-10-20 16:12:23 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-10-20 16:12:23 +0000
commitd9c6b09ac42d21abd151a0feaff676b8a8a24bb9 (patch)
treec855864e24f765881448e581fca30945207ba34e /net.h
parent2ea5fa07105ef52ba94c43e6a70a14ef6008abb0 (diff)
Gavin Andresen: multiple instance check, -testnet use port 18333
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@170 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'net.h')
-rw-r--r--net.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/net.h b/net.h
index 698bd0b2a2..33c59147bb 100644
--- a/net.h
+++ b/net.h
@@ -12,7 +12,7 @@ extern int nBestHeight;
-static const unsigned short DEFAULT_PORT = 0x8d20; // htons(8333)
+inline unsigned short GetDefaultPort() { return fTestNet ? htons(18333) : htons(8333); }
static const unsigned int PUBLISH_HOPS = 5;
enum
{
@@ -150,11 +150,11 @@ public:
Init();
}
- CAddress(unsigned int ipIn, unsigned short portIn=DEFAULT_PORT, uint64 nServicesIn=NODE_NETWORK)
+ CAddress(unsigned int ipIn, unsigned short portIn=0, uint64 nServicesIn=NODE_NETWORK)
{
Init();
ip = ipIn;
- port = portIn;
+ port = (portIn == 0 ? GetDefaultPort() : portIn);
nServices = nServicesIn;
}
@@ -185,7 +185,7 @@ public:
nServices = NODE_NETWORK;
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
ip = INADDR_NONE;
- port = DEFAULT_PORT;
+ port = GetDefaultPort();
nTime = GetAdjustedTime();
nLastTry = 0;
}
@@ -193,7 +193,7 @@ public:
bool SetAddress(const char* pszIn)
{
ip = INADDR_NONE;
- port = DEFAULT_PORT;
+ port = GetDefaultPort();
char psz[100];
strlcpy(psz, pszIn, sizeof(psz));
unsigned int a=0, b=0, c=0, d=0, e=0;