diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-06-14 18:13:46 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-06-14 18:13:46 +0000 |
commit | 6ec9d30905e8df77e60d0195074920271abb977a (patch) | |
tree | 59b21a9be7282b5ee3a2dc6c0b4f2d5a31882904 | |
parent | 722ff53718333dc290760d528b7a561d29ab41a8 (diff) | |
parent | 3703150d56ff6ee557ab330e55637c9c23835902 (diff) |
Merge branch '0.5.x' into 0.6.0.x
Conflicts:
src/main.h
src/net.cpp
src/serialize.h
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | contrib/debian/control | 4 | ||||
-rw-r--r-- | contrib/gitian-downloader/linux-download-config | 2 | ||||
-rw-r--r-- | contrib/gitian-downloader/win32-download-config | 2 | ||||
-rw-r--r-- | doc/build-unix.txt | 2 | ||||
-rw-r--r-- | doc/release-process.txt | 2 | ||||
-rw-r--r-- | src/bitcoinrpc.cpp | 13 | ||||
-rw-r--r-- | src/init.cpp | 14 | ||||
-rw-r--r-- | src/init.h | 1 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/net.cpp | 4 | ||||
-rw-r--r-- | src/qt/addressbookpage.cpp | 5 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 6 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 4 | ||||
-rw-r--r-- | src/qt/forms/overviewpage.ui | 4 | ||||
-rw-r--r-- | src/qtui.h | 1 | ||||
-rw-r--r-- | src/test/test_bitcoin.cpp | 6 | ||||
-rw-r--r-- | src/util.cpp | 3 |
18 files changed, 49 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore index 6ed527d5d4..95152ce4fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ src/*.exe src/bitcoin src/bitcoind +src/test_bitcoin .*.swp *.*~* *.bak diff --git a/contrib/debian/control b/contrib/debian/control index 745fd71ea8..b81c02ec1a 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -35,7 +35,7 @@ Description: peer-to-peer network based digital currency - daemon By default connects to an IRC network to discover other peers. . Full transaction history is stored locally at each client. This - requires 150+ MB of space, slowly growing. + requires 2+ GB of space, slowly growing. . This package provides bitcoind, a combined daemon and CLI tool to interact with the daemon. @@ -53,6 +53,6 @@ Description: peer-to-peer network based digital currency - QT GUI By default connects to an IRC network to discover other peers. . Full transaction history is stored locally at each client. This - requires 150+ MB of space, slowly growing. + requires 2+ GB of space, slowly growing. . This package provides bitcoin-qt, a GUI for Bitcoin based on QT. diff --git a/contrib/gitian-downloader/linux-download-config b/contrib/gitian-downloader/linux-download-config index 88e48e2c23..aef614d0ca 100644 --- a/contrib/gitian-downloader/linux-download-config +++ b/contrib/gitian-downloader/linux-download-config @@ -31,7 +31,7 @@ signers: weight: 40 name: "Gavin Andresen" key: gavinandresen - 71A3B16735405025D447E8F274810B012346C9A6 + 71A3B16735405025D447E8F274810B012346C9A6: weight: 40 name: "Wladimir J. van der Laan" key: laanwj diff --git a/contrib/gitian-downloader/win32-download-config b/contrib/gitian-downloader/win32-download-config index 595626f28f..0f7032e643 100644 --- a/contrib/gitian-downloader/win32-download-config +++ b/contrib/gitian-downloader/win32-download-config @@ -31,7 +31,7 @@ signers: weight: 40 name: "Gavin Andresen" key: gavinandresen - 71A3B16735405025D447E8F274810B012346C9A6 + 71A3B16735405025D447E8F274810B012346C9A6: weight: 40 name: "Wladimir J. van der Laan" key: laanwj diff --git a/doc/build-unix.txt b/doc/build-unix.txt index a9bc551d3c..f93ddcd969 100644 --- a/doc/build-unix.txt +++ b/doc/build-unix.txt @@ -33,7 +33,7 @@ Dependencies miniupnpc may be used for UPnP port mapping. It can be downloaded from http://miniupnp.tuxfamily.org/files/. UPnP support is compiled in and turned off by default. Set USE_UPNP to a different value to control this: - USE_UPNP= No UPnP support - miniupnp not required + USE_UPNP=- No UPnP support - miniupnp not required USE_UPNP=0 (the default) UPnP support turned off by default at runtime USE_UPNP=1 UPnP support turned on by default at runtime diff --git a/doc/release-process.txt b/doc/release-process.txt index 05db17e323..0bd75fa880 100644 --- a/doc/release-process.txt +++ b/doc/release-process.txt @@ -98,6 +98,8 @@ * update wiki download links +* update wiki changelog: https://en.bitcoin.it/wiki/Changelog + * Commit your signature to gitian.sigs: pushd gitian.sigs git add ${VERSION}/${SIGNER} diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 71725ac335..78812ba632 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -223,7 +223,8 @@ Value stop(const Array& params, bool fHelp) "Stop bitcoin server."); #ifndef QT_GUI // Shutdown will take long enough that the response should get back - CreateThread(Shutdown, NULL); + // NOTE: This should actually work with Bitcoin-Qt too now, but 0.6.0 didn't allow it + StartShutdown(); return "bitcoin server stopping"; #else throw runtime_error("NYI: cannot shut down GUI with RPC command"); @@ -1713,7 +1714,7 @@ Value encryptwallet(const Array& params, bool fHelp) // BDB seems to have a bad habit of writing old data into // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: - CreateThread(Shutdown, NULL); + StartShutdown(); return "wallet encrypted; bitcoin server stopping, restart to run with encrypted wallet"; } @@ -2372,10 +2373,6 @@ void ThreadRPCServer(void* parg) printf("ThreadRPCServer exiting\n"); } -#ifdef QT_GUI -extern bool HACK_SHUTDOWN; -#endif - void ThreadRPCServer2(void* parg) { printf("ThreadRPCServer started\n"); @@ -2402,7 +2399,7 @@ void ThreadRPCServer2(void* parg) EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()), _("Error"), wxOK | wxMODAL); #ifndef QT_GUI - CreateThread(Shutdown, NULL); + StartShutdown(); #endif return; } @@ -2427,9 +2424,9 @@ void ThreadRPCServer2(void* parg) } catch(boost::system::system_error &e) { - HACK_SHUTDOWN = true; ThreadSafeMessageBox(strprintf(_("An error occured while setting up the RPC port %i for listening: %s"), endpoint.port(), e.what()), _("Error"), wxOK | wxMODAL); + StartShutdown(); return; } #endif diff --git a/src/init.cpp b/src/init.cpp index 8d8ce8f4af..586e3dab4b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -42,6 +42,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) + 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; @@ -67,7 +78,10 @@ void Shutdown(void* parg) Sleep(50); printf("Bitcoin exiting\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 { diff --git a/src/init.h b/src/init.h index 80894827a0..f038d7b621 100644 --- a/src/init.h +++ b/src/init.h @@ -7,6 +7,7 @@ extern CWallet* pwalletMain; +void StartShutdown(); void Shutdown(void* parg); bool AppInit(int argc, char* argv[]); bool AppInit2(int argc, char* argv[]); diff --git a/src/main.cpp b/src/main.cpp index 7ffecaf734..a4b0a1d8cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1840,7 +1840,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes) strMiscWarning = strMessage; printf("*** %s\n", strMessage.c_str()); ThreadSafeMessageBox(strMessage, "Bitcoin", wxOK | wxICON_EXCLAMATION); - CreateThread(Shutdown, NULL); + StartShutdown(); return false; } return true; diff --git a/src/net.cpp b/src/net.cpp index 6707d790e2..d927c505e0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -693,7 +693,7 @@ void ThreadSocketHandler2(void* parg) if (nSelect == SOCKET_ERROR) { int nErr = WSAGetLastError(); - if (hSocketMax > -1) + if (hSocketMax != INVALID_SOCKET) { printf("socket select error %d\n", nErr); for (unsigned int i = 0; i <= hSocketMax; i++) @@ -1535,7 +1535,7 @@ void ThreadMessageHandler2(void* parg) vnThreadsRunning[THREAD_MESSAGEHANDLER]--; Sleep(100); if (fRequestShutdown) - Shutdown(NULL); + StartShutdown(); vnThreadsRunning[THREAD_MESSAGEHANDLER]++; if (fShutdown) return; diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 387043ae2b..32d05053ce 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -121,11 +121,6 @@ void AddressBookPage::setModel(AddressTableModel *model) connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged())); - if(mode == ForSending) - { - // Auto-select first row when in sending mode - ui->tableView->selectRow(0); - } selectionChanged(); } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 9fea2c151e..58070d4057 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -123,6 +123,11 @@ void InitMessage(const std::string &message) } } +void QueueShutdown() +{ + QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection); +} + /* Translate string to current locale using Qt. */ @@ -290,6 +295,7 @@ int main(int argc, char *argv[]) window.hide(); guiref = 0; } + // Shutdown the core and it's threads, but don't exit Bitcoin-Qt here Shutdown(NULL); } else diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 175fc4f493..4918dddb92 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -552,16 +552,12 @@ void BitcoinGUI::refreshStatusBar() setNumBlocks(clientModel->getNumBlocks()); } -bool HACK_SHUTDOWN = false; - void BitcoinGUI::error(const QString &title, const QString &message, bool modal) { // Report errors from network/worker thread if (modal) { QMessageBox::critical(this, title, message, QMessageBox::Ok, QMessageBox::Ok); - if (HACK_SHUTDOWN) - QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection); } else { notificator->notify(Notificator::Critical, title, message); } diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 3cf7dd0ed3..10e470e918 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -44,7 +44,7 @@ <item row="2" column="1"> <widget class="QLabel" name="labelBalance"> <property name="text"> - <string>123.456 BTC</string> + <string notr="true">0 BTC</string> </property> </widget> </item> @@ -72,7 +72,7 @@ <item row="3" column="1"> <widget class="QLabel" name="labelUnconfirmed"> <property name="text"> - <string>0 BTC</string> + <string notr="true">0 BTC</string> </property> </widget> </item> diff --git a/src/qtui.h b/src/qtui.h index c25abf5e67..e6ca0cb17b 100644 --- a/src/qtui.h +++ b/src/qtui.h @@ -46,6 +46,7 @@ extern void ThreadSafeHandleURI(const std::string& strURI); extern void CalledSetStatusBar(const std::string& strText, int nField); extern void UIThreadCall(boost::function0<void> fn); extern void MainFrameRepaint(); +extern void QueueShutdown(); extern void InitMessage(const std::string &message); extern std::string _(const char* psz); diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 7ff7545ab4..c7e4bdd556 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -26,3 +26,9 @@ void Shutdown(void* parg) { exit(0); } + +void StartShutdown() +{ + exit(0); +} + diff --git a/src/util.cpp b/src/util.cpp index 393f927491..94bdba6ffb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -23,6 +23,7 @@ namespace boost { #include <boost/interprocess/sync/interprocess_mutex.hpp> #include <boost/interprocess/sync/interprocess_recursive_mutex.hpp> #include <boost/foreach.hpp> +#include <boost/thread.hpp> using namespace std; using namespace boost; @@ -194,6 +195,8 @@ inline int OutputDebugStringF(const char* pszFormat, ...) if (fileout) { static bool fStartedNewLine = true; + static boost::mutex mutexDebugLog; + boost::mutex::scoped_lock scoped_lock(mutexDebugLog); // Debug print useful for profiling if (fLogTimestamps && fStartedNewLine) |