- A5977F1E2AD59EEEEFBCB59E32A935724653FD328E65570D9B7A6270F1CA1F27A00E2221C05DA122372D203B3CCC82DD04D3EADC745A6D7F7ADD3F5CF6ACA410
+ EAF9888F03CFC0267577D217D24B0FBA45D5D141E9D8536081059B97195590A0F7AA8D27704CABD46D1AF5033733B96D1BB01C47DCFBD636DB659DB101CC4A45
bitcoin/src/net.cpp
(29 . 9)(29 . 8)
50 // Global state variables
51 //
52 bool fClient = false;
53 bool fAllowDNS = false;
54 uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
55 CAddress addrLocalHost("0.0.0.0", 0, false, nLocalServices);
56 CAddress addrLocalHost("0.0.0.0", 0, nLocalServices);
57 static CNode* pnodeLocalHost = NULL;
58 uint64 nLocalHostNonce = 0;
59 array<int, 10> vnThreadsRunning;
(193 . 7)(192 . 7)
61 }
62
63 // portDefault is in host order
64 bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup, int portDefault, bool fAllowPort)
65 bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMaxSolutions, int portDefault, bool fAllowPort)
66 {
67 vaddr.clear();
68 if (pszName[0] == 0)
(231 . 33)(230 . 14)
70 return true;
71 }
72
73 if (!fAllowLookup)
74 return false;
75
76 struct hostent* phostent = gethostbyname(pszHost);
77 if (!phostent)
78 return false;
79
80 if (phostent->h_addrtype != AF_INET)
81 return false;
82
83 char** ppAddr = phostent->h_addr_list;
84 while (*ppAddr != NULL && vaddr.size() != nMaxSolutions)
85 {
86 CAddress addr(((struct in_addr*)ppAddr[0])->s_addr, port, nServices);
87 if (addr.IsValid())
88 vaddr.push_back(addr);
89 ppAddr++;
90 }
91
92 return (vaddr.size() > 0);
93 return false;
94 }
95
96 // portDefault is in host order
97 bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup, int portDefault, bool fAllowPort)
98 bool Lookup(const char *pszName, CAddress& addr, int nServices, int portDefault, bool fAllowPort)
99 {
100 vector<CAddress> vaddr;
101 bool fRet = Lookup(pszName, vaddr, nServices, 1, fAllowLookup, portDefault, fAllowPort);
102 bool fRet = Lookup(pszName, vaddr, nServices, 1, portDefault, fAllowPort);
103 if (fRet)
104 addr = vaddr[0];
105 return fRet;
(972 . 7)(952 . 7)
107 {
108 BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"])
109 {
110 CAddress addr(strAddr, fAllowDNS);
111 CAddress addr(strAddr);
112 if (addr.IsValid())
113 OpenNetworkConnection(addr);
114 for (int i = 0; i < 10 && i < nLoop; i++)
(990 . 7)(970 . 7)
116 {
117 BOOST_FOREACH(string strAddr, mapMultiArgs["-addnode"])
118 {
119 CAddress addr(strAddr, fAllowDNS);
120 CAddress addr(strAddr);
121 if (addr.IsValid())
122 {
123 OpenNetworkConnection(addr);
(1275 . 7)(1255 . 7)
125 void StartNode(void* parg)
126 {
127 if (pnodeLocalHost == NULL)
128 pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress("127.0.0.1", 0, false, nLocalServices));
129 pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress("127.0.0.1", 0, nLocalServices));
130
131 // Get local host ip
132 struct ifaddrs* myaddrs;