aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 04541c540f..21c32a6d67 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -38,6 +38,17 @@ void ExitTimeout(void* parg)
#endif
}
+void StartShutdown()
+{
+#ifdef QT_GUI
+ // ensure we leave the Qt main loop for a clean GUI exit (Shutdown() is called in bitcoin.cpp afterwards)
+ uiInterface.QueueShutdown();
+#else
+ // Without UI, Shutdown() can simply be started in a new thread
+ CreateThread(Shutdown, NULL);
+#endif
+}
+
void Shutdown(void* parg)
{
static CCriticalSection cs_Shutdown;
@@ -66,7 +77,10 @@ void Shutdown(void* parg)
Sleep(50);
printf("Bitcoin exited\n\n");
fExit = true;
+#ifndef QT_GUI
+ // ensure non UI client get's exited here, but let Bitcoin-Qt reach return 0; in bitcoin.cpp
exit(0);
+#endif
}
else
{
@@ -330,7 +344,7 @@ bool AppInit2()
SoftSetBoolArg("-listen", false);
}
- if (GetBoolArg("-listen", true)) {
+ if (!GetBoolArg("-listen", true)) {
// do not map ports or try to retrieve public IP when not listening (pointless)
SoftSetBoolArg("-upnp", false);
SoftSetBoolArg("-discover", false);