Merge remote branch 'refs/remotes/svn/trunk' into svn

This commit is contained in:
Gavin Andresen 2010-11-16 09:04:24 -05:00
commit 8595d31ee8
4 changed files with 28 additions and 17 deletions

18
net.cpp
View file

@ -128,7 +128,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
string strLine; string strLine;
while (RecvLine(hSocket, strLine)) while (RecvLine(hSocket, strLine))
{ {
if (strLine.empty()) if (strLine.empty()) // HTTP response is separated from headers by blank line
{ {
loop loop
{ {
@ -137,6 +137,8 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
closesocket(hSocket); closesocket(hSocket);
return false; return false;
} }
if (pszKeyword == NULL)
break;
if (strLine.find(pszKeyword) != -1) if (strLine.find(pszKeyword) != -1)
{ {
strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword)); strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
@ -176,26 +178,26 @@ bool GetMyExternalIP(unsigned int& ipRet)
{ {
if (nHost == 1) if (nHost == 1)
{ {
addrConnect = CAddress("70.86.96.218:80"); // www.ipaddressworld.com addrConnect = CAddress("72.233.89.199:80"); // www.whatismyip.com
if (nLookup == 1) if (nLookup == 1)
{ {
struct hostent* phostent = gethostbyname("www.ipaddressworld.com"); struct hostent* phostent = gethostbyname("www.whatismyip.com");
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0]) if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80)); addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
} }
pszGet = "GET /ip.php HTTP/1.1\r\n" pszGet = "GET /automation/n09230945.asp HTTP/1.1\r\n"
"Host: www.ipaddressworld.com\r\n" "Host: www.whatismyip.com\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n" "User-Agent: Bitcoin/1.0 (see www.bitcoin.org)\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"\r\n"; "\r\n";
pszKeyword = "IP:"; pszKeyword = NULL; // Returns just IP address
} }
else if (nHost == 2) else if (nHost == 2)
{ {
addrConnect = CAddress("208.78.68.70:80"); // checkip.dyndns.org addrConnect = CAddress("91.198.22.70:80"); // checkip.dyndns.org
if (nLookup == 1) if (nLookup == 1)
{ {

View file

@ -22,7 +22,7 @@ class CDataStream;
class CAutoFile; class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000; static const unsigned int MAX_SIZE = 0x02000000;
static const int VERSION = 31403; static const int VERSION = 31501;
static const char* pszSubVer = ""; static const char* pszSubVer = "";

View file

@ -7,7 +7,7 @@ RequestExecutionLevel highest
# General Symbol Definitions # General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)" !define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 0.3.14 !define VERSION 0.3.15
!define COMPANY "Bitcoin project" !define COMPANY "Bitcoin project"
!define URL http://www.bitcoin.org/ !define URL http://www.bitcoin.org/
@ -42,12 +42,12 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English !insertmacro MUI_LANGUAGE English
# Installer attributes # Installer attributes
OutFile bitcoin-0.3.14-win32-setup.exe OutFile bitcoin-0.3.15-win32-setup.exe
InstallDir $PROGRAMFILES\Bitcoin InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on CRCCheck on
XPStyle on XPStyle on
ShowInstDetails show ShowInstDetails show
VIProductVersion 0.3.14.0 VIProductVersion 0.3.15.0
VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey CompanyName "${COMPANY}"

View file

@ -157,10 +157,19 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
else else
{ {
// print to debug.log // print to debug.log
char pszFile[MAX_PATH+100]; static FILE* fileout = NULL;
GetDataDir(pszFile); static int64 nOpenTime = 0;
strlcat(pszFile, "/debug.log", sizeof(pszFile));
FILE* fileout = fopen(pszFile, "a"); if (GetTime()-nOpenTime > 10 * 60)
{
if (fileout)
fclose(fileout);
char pszFile[MAX_PATH+100];
GetDataDir(pszFile);
strlcat(pszFile, "/debug.log", sizeof(pszFile));
fileout = fopen(pszFile, "a");
nOpenTime = GetTime();
}
if (fileout) if (fileout)
{ {
//// Debug print useful for profiling //// Debug print useful for profiling
@ -169,7 +178,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
va_start(arg_ptr, pszFormat); va_start(arg_ptr, pszFormat);
ret = vfprintf(fileout, pszFormat, arg_ptr); ret = vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr); va_end(arg_ptr);
fclose(fileout); fflush(fileout);
} }
} }