misc exit code, updated setup.nsi

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@46 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
s_nakamoto 2009-12-13 00:13:16 +00:00
parent 651d335569
commit e39bc50eb4
5 changed files with 43 additions and 15 deletions

1
db.cpp
View File

@ -637,6 +637,7 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
pcursor->close(); pcursor->close();
} }
printf("nFileVersion = %d\n", nFileVersion);
printf("fShowGenerated = %d\n", fShowGenerated); printf("fShowGenerated = %d\n", fShowGenerated);
printf("fGenerateBitcoins = %d\n", fGenerateBitcoins); printf("fGenerateBitcoins = %d\n", fGenerateBitcoins);
printf("nTransactionFee = %"PRI64d"\n", nTransactionFee); printf("nTransactionFee = %"PRI64d"\n", nTransactionFee);

11
net.cpp
View File

@ -929,7 +929,7 @@ void ThreadOpenConnections2(void* parg)
// Only try the old stuff if we don't have enough connections // Only try the old stuff if we don't have enough connections
if (vNodes.size() >= 2 && nSinceLastSeen > 7 * 24 * 60 * 60) if (vNodes.size() >= 2 && nSinceLastSeen > 7 * 24 * 60 * 60)
continue; continue;
if (vNodes.size() >= 4 && nSinceLastSeen > 24 * 60 * 60) if (vNodes.size() >= 5 && nSinceLastSeen > 24 * 60 * 60)
continue; continue;
// If multiple addresses are ready, prioritize by time since // If multiple addresses are ready, prioritize by time since
@ -1256,11 +1256,14 @@ void StartNode(void* parg)
// //
// Thread monitoring // Thread monitoring
// Not really needed anymore, the cause of the hanging was fixed
// //
loop loop
{ {
Sleep(15000); Sleep(1000);
if (GetTime() - nThreadSocketHandlerHeartbeat > 4 * 60) if (fShutdown)
return;
if (GetTime() - nThreadSocketHandlerHeartbeat > 15 * 60)
{ {
// First see if closing sockets will free it // First see if closing sockets will free it
printf("*** ThreadSocketHandler is stopped ***\n"); printf("*** ThreadSocketHandler is stopped ***\n");
@ -1280,6 +1283,8 @@ void StartNode(void* parg)
} }
} }
Sleep(10000); Sleep(10000);
if (fShutdown)
return;
if (GetTime() - nThreadSocketHandlerHeartbeat < 60) if (GetTime() - nThreadSocketHandlerHeartbeat < 60)
continue; continue;

View File

@ -19,8 +19,8 @@ class CScript;
class CDataStream; class CDataStream;
class CAutoFile; class CAutoFile;
static const int VERSION = 106; static const int VERSION = 200;
static const char* pszSubVer = " test11"; static const char* pszSubVer = " rc1";

View File

@ -7,12 +7,12 @@ RequestExecutionLevel highest
# General Symbol Definitions # General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)" !define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 0.1.6 !define VERSION 0.2.0
!define COMPANY "Bitcoin project" !define COMPANY "Bitcoin project"
!define URL http://bitcoin.sourceforge.net/ !define URL http://www.bitcoin.org/
# MUI Symbol Definitions # MUI Symbol Definitions
!define MUI_ICON "rc\bitcoin.ico" !define MUI_ICON "src\rc\bitcoin.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
@ -42,12 +42,12 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English !insertmacro MUI_LANGUAGE English
# Installer attributes # Installer attributes
OutFile Bitcoin_0.1.6_setup.exe OutFile bitcoin-0.2.0-setup.exe
InstallDir $PROGRAMFILES\Bitcoin InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on CRCCheck on
XPStyle on XPStyle on
ShowInstDetails show ShowInstDetails show
VIProductVersion 0.1.6.0 VIProductVersion 0.2.0.0
VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey CompanyName "${COMPANY}"
@ -65,6 +65,11 @@ Section -Main SEC0000
File bitcoin.exe File bitcoin.exe
File libeay32.dll File libeay32.dll
File mingwm10.dll File mingwm10.dll
File license.txt
File readme.txt
SetOutPath $INSTDIR\src
File /r src\*.*
SetOutPath $INSTDIR
WriteRegStr HKCU "${REGKEY}\Components" Main 1 WriteRegStr HKCU "${REGKEY}\Components" Main 1
SectionEnd SectionEnd
@ -102,9 +107,12 @@ done${UNSECTION_ID}:
# Uninstaller sections # Uninstaller sections
Section /o -un.Main UNSEC0000 Section /o -un.Main UNSEC0000
Delete /REBOOTOK $INSTDIR\mingwm10.dll
Delete /REBOOTOK $INSTDIR\libeay32.dll
Delete /REBOOTOK $INSTDIR\bitcoin.exe Delete /REBOOTOK $INSTDIR\bitcoin.exe
Delete /REBOOTOK $INSTDIR\libeay32.dll
Delete /REBOOTOK $INSTDIR\mingwm10.dll
Delete /REBOOTOK $INSTDIR\license.txt
Delete /REBOOTOK $INSTDIR\readme.txt
RMDir /r /REBOOTOK $INSTDIR\src
DeleteRegValue HKCU "${REGKEY}\Components" Main DeleteRegValue HKCU "${REGKEY}\Components" Main
SectionEnd SectionEnd
@ -114,6 +122,7 @@ Section -un.post UNSEC0001
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe Delete /REBOOTOK $INSTDIR\uninstall.exe
Delete /REBOOTOK $INSTDIR\debug.log
Delete /REBOOTOK $INSTDIR\db.log Delete /REBOOTOK $INSTDIR\db.log
DeleteRegValue HKCU "${REGKEY}" StartMenuGroup DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
DeleteRegValue HKCU "${REGKEY}" Path DeleteRegValue HKCU "${REGKEY}" Path
@ -139,4 +148,3 @@ Function un.onInit
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro SELECT_UNSECTION Main ${UNSEC0000} !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd FunctionEnd

18
ui.cpp
View File

@ -394,6 +394,14 @@ CMainFrame::~CMainFrame()
ptaskbaricon = NULL; ptaskbaricon = NULL;
} }
void ExitTimeout(void* parg)
{
#ifdef __WXMSW__
Sleep(5000);
ExitProcess(0);
#endif
}
void Shutdown(void* parg) void Shutdown(void* parg)
{ {
static CCriticalSection cs_Shutdown; static CCriticalSection cs_Shutdown;
@ -404,6 +412,7 @@ void Shutdown(void* parg)
fFirstThread = !fTaken; fFirstThread = !fTaken;
fTaken = true; fTaken = true;
} }
static bool fExit;
if (fFirstThread) if (fFirstThread)
{ {
fShutdown = true; fShutdown = true;
@ -411,13 +420,18 @@ void Shutdown(void* parg)
DBFlush(false); DBFlush(false);
StopNode(); StopNode();
DBFlush(true); DBFlush(true);
CreateThread(ExitTimeout, NULL);
Sleep(10);
printf("Bitcoin exiting\n\n"); printf("Bitcoin exiting\n\n");
fExit = true;
exit(0); exit(0);
} }
else else
{ {
loop while (!fExit)
Sleep(100000); Sleep(500);
Sleep(100);
ExitThread(0);
} }
} }