tree checksum vpatch file split hunks
all signers: mircea_popescu trinque asciilifeform ben_vulpes mod6
antecedents: bitcoin-asciilifeform.4-goodbye-win32 asciilifeform_zap_showmyip_crud genesis asciilifeform_dnsseed_snipsnip
press order:
patch:
(160 . 7)(160 . 6)- FC9388561AE8AF72AB6F10816CACD133746DE668B500BAE02C239B129DC5E190794A94D7569B7ECBD294844BFE3C2A3A2B5C4E2A0A5F3AA3170DA498A8D0724B
5 " -datadir=<dir> \t\t " + _("Specify data directory\n") +
6 " -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)\n") +
7 " -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") +
8 " -dns \t " + _("Allow DNS lookups for addnode and connect\n") +
9 " -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)\n") +
10 " -maxconnections=<n>\t " + _("Maintain at most <n> connections to peers (default: 125)\n") +
11 " -addnode=<ip> \t " + _("Add a node to connect to\n") +
(414 . 10)(413 . 8)
13 // Note: the GetBoolArg() calls for all of these must happen later.
14 SoftSetArg("-nolisten", true);
15 SoftSetArg("-noirc", true);
16 SoftSetArg("-dns", false);
17 }
18
19 fAllowDNS = GetBoolArg("-dns");
20 fNoListen = GetBoolArg("-nolisten");
21
22 // Command-line args override in-wallet settings:
(435 . 7)(432 . 7)
24 {
25 BOOST_FOREACH(string strAddr, mapMultiArgs["-addnode"])
26 {
27 CAddress addr(strAddr, fAllowDNS);
28 CAddress addr(strAddr);
29 addr.nTime = 0; // so it won't relay unless successfully connected
30 if (addr.IsValid())
31 AddAddress(addr);
(269 . 10)(269 . 6)
36 {
37 CAddress addrConnect("92.243.23.21", 6667); // irc.lfnet.org
38
39 CAddress addrIRC("irc.lfnet.org", 6667, true);
40 if (addrIRC.IsValid())
41 addrConnect = addrIRC;
42
43 SOCKET hSocket;
44 if (!ConnectSocket(addrConnect, hSocket))
45 {
- E49A09443EB1AAF45252696F1731C346C18EFA2FBC3B64D87EDA63E126CC4DD44608B9C554C80DCD112EC5A050CF5A937B6A302D03DCA89C8543F03CEFBFA17C(29 . 9)(29 . 8)- 08231AA424AE8C84086B5B82EA79A7F22FB3403B4245C6D05A20176C4962AE620A35B9CB2505F4B8E33A8F43D077152406007013E49E97AB1CEED6B158B77A0F
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;
(26 . 8)(26 . 8)
137 static const unsigned int PUBLISH_HOPS = 5;
138
139 bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout=nConnectTimeout);
140 bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
141 bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
142 bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, int portDefault = 0, bool fAllowPort = false);
143 bool Lookup(const char *pszName, CAddress& addr, int nServices, int portDefault = 0, bool fAllowPort = false);
144 bool GetMyExternalIP(unsigned int& ipRet);
145 bool AddAddress(CAddress addr, int64 nTimePenalty=0, CAddrDB *pAddrDB=NULL);
146 void AddressCurrentlyConnected(const CAddress& addr);
- 8FAEDDC8CA1B84E53EDEE8F3325EDD7DB8B74E063F4D338AE7E280C02DCE96E8156157A6802FEAB5B7F695981E6F8A42AB5F44B9DF3093A4D7C4F30F9B029912(9 . 8)(9 . 8)- EB06FFB5A1D9A725CCE5C48FABF4EA4E9147ACEB065ACC54AE21C6D4B4065EBF5715D2DC88D3934312517A15247FF689711EDE12328F5B8DEADB6E2B43253C35
151
152
153 // Prototypes from net.h, but that header (currently) stinks, can't #include it without breaking things
154 bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
155 bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
156 bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, int portDefault = 0, bool fAllowPort = false);
157 bool Lookup(const char *pszName, CAddress& addr, int nServices, int portDefault = 0, bool fAllowPort = false);
158
159 static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
160 static const char* ppszTypeName[] =
(96 . 28)(96 . 28)
162 nServices = nServicesIn;
163 }
164
165 CAddress::CAddress(const char* pszIn, int portIn, bool fNameLookup, uint64 nServicesIn)
166 CAddress::CAddress(const char* pszIn, int portIn, uint64 nServicesIn)
167 {
168 Init();
169 Lookup(pszIn, *this, nServicesIn, fNameLookup, portIn);
170 Lookup(pszIn, *this, nServicesIn, portIn);
171 }
172
173 CAddress::CAddress(const char* pszIn, bool fNameLookup, uint64 nServicesIn)
174 CAddress::CAddress(const char* pszIn, uint64 nServicesIn)
175 {
176 Init();
177 Lookup(pszIn, *this, nServicesIn, fNameLookup, 0, true);
178 Lookup(pszIn, *this, nServicesIn, 0, true);
179 }
180
181 CAddress::CAddress(std::string strIn, int portIn, bool fNameLookup, uint64 nServicesIn)
182 CAddress::CAddress(std::string strIn, int portIn, uint64 nServicesIn)
183 {
184 Init();
185 Lookup(strIn.c_str(), *this, nServicesIn, fNameLookup, portIn);
186 Lookup(strIn.c_str(), *this, nServicesIn, portIn);
187 }
188
189 CAddress::CAddress(std::string strIn, bool fNameLookup, uint64 nServicesIn)
190 CAddress::CAddress(std::string strIn, uint64 nServicesIn)
191 {
192 Init();
193 Lookup(strIn.c_str(), *this, nServicesIn, fNameLookup, 0, true);
194 Lookup(strIn.c_str(), *this, nServicesIn, 0, true);
195 }
196
197 void CAddress::Init()
(67 . 10)(67 . 10)
202 CAddress();
203 CAddress(unsigned int ipIn, unsigned short portIn=0, uint64 nServicesIn=NODE_NETWORK);
204 explicit CAddress(const struct sockaddr_in& sockaddr, uint64 nServicesIn=NODE_NETWORK);
205 explicit CAddress(const char* pszIn, int portIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
206 explicit CAddress(const char* pszIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
207 explicit CAddress(std::string strIn, int portIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
208 explicit CAddress(std::string strIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
209 explicit CAddress(const char* pszIn, int portIn, uint64 nServicesIn=NODE_NETWORK);
210 explicit CAddress(const char* pszIn, uint64 nServicesIn=NODE_NETWORK);
211 explicit CAddress(std::string strIn, int portIn, uint64 nServicesIn=NODE_NETWORK);
212 explicit CAddress(std::string strIn, uint64 nServicesIn=NODE_NETWORK);
213
214 void Init();
215