Wallet Repair Buttons added

This commit is contained in:
crowning- 2015-05-25 22:59:38 +02:00
parent 9a6fe03974
commit 3ab747d8ff
4 changed files with 21 additions and 19 deletions

View File

@ -146,8 +146,7 @@ static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
/** Preparing steps before restarting the wallet */ /** Preparing steps before restarting the wallet */
void Prepare_Restart() void Prepare_Restart()
{ {
printf("Prepare_Restart called! ---------------------------\n"); LogPrintf("%s: In progress...\n", __func__);
LogPrintf("%s: In progress...\n", __func__);
static CCriticalSection cs_Shutdown; static CCriticalSection cs_Shutdown;
TRY_LOCK(cs_Shutdown, lockShutdown); TRY_LOCK(cs_Shutdown, lockShutdown);
if (!lockShutdown) if (!lockShutdown)

View File

@ -1739,11 +1739,13 @@ public:
} }
instance_of_cnetcleanup; instance_of_cnetcleanup;
void CExplicitNetCleanup::callCleanup()
{
// Explicit call to destructor of CNetCleanup because it's not implicitly called
// when the wallet is restarted from within the wallet itself.
CNetCleanup *tmp = new CNetCleanup();
delete tmp; // Stroustrup's gonna kill me for that
}
void RelayTransaction(const CTransaction& tx) void RelayTransaction(const CTransaction& tx)
{ {

View File

@ -672,7 +672,11 @@ public:
static uint64_t GetTotalBytesSent(); static uint64_t GetTotalBytesSent();
}; };
class CExplicitNetCleanup
{
public:
static void callCleanup();
};
class CTransaction; class CTransaction;
void RelayTransaction(const CTransaction& tx); void RelayTransaction(const CTransaction& tx);

View File

@ -13,6 +13,7 @@
#include "guiconstants.h" #include "guiconstants.h"
#include "guiutil.h" #include "guiutil.h"
#include "intro.h" #include "intro.h"
#include "net.h"
#include "networkstyle.h" #include "networkstyle.h"
#include "optionsmodel.h" #include "optionsmodel.h"
#include "splashscreen.h" #include "splashscreen.h"
@ -280,25 +281,22 @@ void BitcoinCore::initialize()
} }
} }
void BitcoinCore::restart(QStringList args) // ToDo void BitcoinCore::restart(QStringList args)
{ {
printf("restart in dash.cpp -------------------------------------------\n");
for (int i = 0; i < args.size(); ++i){
printf("%s\n", args.at(i).toStdString().c_str());
}
try try
{ {
qDebug() << __func__ << ": Running Restart in thread"; qDebug() << __func__ << ": Running Restart in thread";
threadGroup.interrupt_all(); threadGroup.interrupt_all();
threadGroup.join_all(); threadGroup.join_all();
// Shutdown();
Prepare_Restart(); Prepare_Restart();
qDebug() << __func__ << ": Shutdown finished"; qDebug() << __func__ << ": Shutdown finished";
emit shutdownResult(1); emit shutdownResult(1);
boost::this_thread::sleep( boost::posix_time::seconds(1) ); CExplicitNetCleanup::callCleanup();
boost::this_thread::sleep( boost::posix_time::seconds(1));
QProcess::startDetached(QApplication::applicationFilePath(), args); QProcess::startDetached(QApplication::applicationFilePath(), args);
QCoreApplication::quit(); qDebug() << __func__ << ": Restart initiated...";
QCoreApplication::quit();
} catch (std::exception& e) { } catch (std::exception& e) {
handleRunawayException(&e); handleRunawayException(&e);
} catch (...) { } catch (...) {
@ -308,7 +306,6 @@ void BitcoinCore::restart(QStringList args) // ToDo
void BitcoinCore::shutdown() void BitcoinCore::shutdown()
{ {
printf("shutdown in dash.cpp -------------------------------------------\n");
try try
{ {
qDebug() << __func__ << ": Running Shutdown in thread"; qDebug() << __func__ << ": Running Shutdown in thread";