|
|
@ -56,6 +56,10 @@ CAddress addrProxy("127.0.0.1",9050); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short GetListenPort() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return (unsigned short)(GetArg("-port", GetDefaultPort())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd) |
|
|
|
void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -84,8 +88,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet) |
|
|
|
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); |
|
|
|
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
bool fRoutable = !(addrConnect.GetByte(3) == 10 || (addrConnect.GetByte(3) == 192 && addrConnect.GetByte(2) == 168)); |
|
|
|
bool fProxy = (fUseProxy && addrConnect.IsRoutable()); |
|
|
|
bool fProxy = (fUseProxy && fRoutable); |
|
|
|
|
|
|
|
struct sockaddr_in sockaddr = (fProxy ? addrProxy.GetSockAddr() : addrConnect.GetSockAddr()); |
|
|
|
struct sockaddr_in sockaddr = (fProxy ? addrProxy.GetSockAddr() : addrConnect.GetSockAddr()); |
|
|
|
|
|
|
|
|
|
|
|
if (connect(hSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR) |
|
|
|
if (connect(hSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR) |
|
|
@ -965,7 +968,7 @@ void ThreadMapPort2(void* parg) |
|
|
|
printf("ThreadMapPort started\n"); |
|
|
|
printf("ThreadMapPort started\n"); |
|
|
|
|
|
|
|
|
|
|
|
char port[6]; |
|
|
|
char port[6]; |
|
|
|
sprintf(port, "%d", GetDefaultPort()); |
|
|
|
sprintf(port, "%d", GetListenPort()); |
|
|
|
|
|
|
|
|
|
|
|
const char * rootdescurl = 0; |
|
|
|
const char * rootdescurl = 0; |
|
|
|
const char * multicastif = 0; |
|
|
|
const char * multicastif = 0; |
|
|
@ -1058,7 +1061,7 @@ void DNSAddressSeed() |
|
|
|
|
|
|
|
|
|
|
|
for (int seed_idx = 0; seed_idx < ARRAYLEN(strDNSSeed); seed_idx++) { |
|
|
|
for (int seed_idx = 0; seed_idx < ARRAYLEN(strDNSSeed); seed_idx++) { |
|
|
|
vector<CAddress> vaddr; |
|
|
|
vector<CAddress> vaddr; |
|
|
|
if (Lookup(strDNSSeed[seed_idx], vaddr, NODE_NETWORK, true)) |
|
|
|
if (Lookup(strDNSSeed[seed_idx], vaddr, NODE_NETWORK, -1, true)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOST_FOREACH (CAddress& addr, vaddr) |
|
|
|
BOOST_FOREACH (CAddress& addr, vaddr) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1435,14 +1438,11 @@ void ThreadMessageHandler2(void* parg) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool BindListenPort(string& strError) |
|
|
|
bool BindListenPort(string& strError) |
|
|
|
{ |
|
|
|
{ |
|
|
|
strError = ""; |
|
|
|
strError = ""; |
|
|
|
int nOne = 1; |
|
|
|
int nOne = 1; |
|
|
|
addrLocalHost.port = htons(GetDefaultPort()); |
|
|
|
addrLocalHost.port = htons(GetListenPort()); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef __WXMSW__ |
|
|
|
#ifdef __WXMSW__ |
|
|
|
// Initialize Windows Sockets
|
|
|
|
// Initialize Windows Sockets
|
|
|
@ -1494,7 +1494,7 @@ bool BindListenPort(string& strError) |
|
|
|
memset(&sockaddr, 0, sizeof(sockaddr)); |
|
|
|
memset(&sockaddr, 0, sizeof(sockaddr)); |
|
|
|
sockaddr.sin_family = AF_INET; |
|
|
|
sockaddr.sin_family = AF_INET; |
|
|
|
sockaddr.sin_addr.s_addr = INADDR_ANY; // bind to all IPs on this computer
|
|
|
|
sockaddr.sin_addr.s_addr = INADDR_ANY; // bind to all IPs on this computer
|
|
|
|
sockaddr.sin_port = htons(GetDefaultPort()); |
|
|
|
sockaddr.sin_port = htons(GetListenPort()); |
|
|
|
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR) |
|
|
|
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int nErr = WSAGetLastError(); |
|
|
|
int nErr = WSAGetLastError(); |
|
|
@ -1556,7 +1556,7 @@ void StartNode(void* parg) |
|
|
|
printf("ipv4 %s: %s\n", ifa->ifa_name, pszIP); |
|
|
|
printf("ipv4 %s: %s\n", ifa->ifa_name, pszIP); |
|
|
|
|
|
|
|
|
|
|
|
// Take the first IP that isn't loopback 127.x.x.x
|
|
|
|
// Take the first IP that isn't loopback 127.x.x.x
|
|
|
|
CAddress addr(*(unsigned int*)&s4->sin_addr, 0, nLocalServices); |
|
|
|
CAddress addr(*(unsigned int*)&s4->sin_addr, GetListenPort(), nLocalServices); |
|
|
|
if (addr.IsValid() && addr.GetByte(3) != 127) |
|
|
|
if (addr.IsValid() && addr.GetByte(3) != 127) |
|
|
|
{ |
|
|
|
{ |
|
|
|
addrLocalHost = addr; |
|
|
|
addrLocalHost = addr; |
|
|
|