efficiently sort transaction dependencies in one pass

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@184 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
s_nakamoto
2010-11-19 20:22:46 +00:00
parent c4679ad0f1
commit 683bcb9154
3 changed files with 106 additions and 57 deletions

38
net.cpp
View File

@@ -177,25 +177,6 @@ bool GetMyExternalIP(unsigned int& ipRet)
for (int nHost = 1; nHost <= 2; nHost++)
{
if (nHost == 1)
{
addrConnect = CAddress("72.233.89.199:80"); // www.whatismyip.com
if (nLookup == 1)
{
struct hostent* phostent = gethostbyname("www.whatismyip.com");
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
}
pszGet = "GET /automation/n09230945.asp HTTP/1.1\r\n"
"Host: www.whatismyip.com\r\n"
"User-Agent: Bitcoin/1.0 (see www.bitcoin.org)\r\n"
"Connection: close\r\n"
"\r\n";
pszKeyword = NULL; // Returns just IP address
}
else if (nHost == 2)
{
addrConnect = CAddress("91.198.22.70:80"); // checkip.dyndns.org
@@ -214,6 +195,25 @@ bool GetMyExternalIP(unsigned int& ipRet)
pszKeyword = "Address:";
}
else if (nHost == 2)
{
addrConnect = CAddress("74.208.43.192:80"); // www.showmyip.com
if (nLookup == 1)
{
struct hostent* phostent = gethostbyname("www.showmyip.com");
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
}
pszGet = "GET /simple/ HTTP/1.1\r\n"
"Host: www.showmyip.com\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
"Connection: close\r\n"
"\r\n";
pszKeyword = NULL; // Returns just IP address
}
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
return true;