forked from Public/monero-gui
SimpleMode: automatic public nodes discovering and switching
This commit is contained in:
@@ -61,7 +61,7 @@ DaemonManager *DaemonManager::instance(const QStringList *args)
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const QString &dataDir, const QString &bootstrapNodeAddress)
|
||||
bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const QString &dataDir, const QString &bootstrapNodeAddress, bool noSync /* = false*/)
|
||||
{
|
||||
// prepare command line arguments and pass to monerod
|
||||
QStringList arguments;
|
||||
@@ -99,6 +99,10 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
arguments << "--bootstrap-daemon-address" << bootstrapNodeAddress;
|
||||
}
|
||||
|
||||
if (noSync) {
|
||||
arguments << "--no-sync";
|
||||
}
|
||||
|
||||
arguments << "--check-updates" << "disabled";
|
||||
|
||||
// --max-concurrency based on threads available. max: 6
|
||||
@@ -131,11 +135,13 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const
|
||||
}
|
||||
|
||||
// Start start watcher
|
||||
m_scheduler.run([this, nettype] {
|
||||
if (startWatcher(nettype))
|
||||
m_scheduler.run([this, nettype, noSync] {
|
||||
if (startWatcher(nettype)) {
|
||||
emit daemonStarted();
|
||||
else
|
||||
m_noSync = noSync;
|
||||
} else {
|
||||
emit daemonStartFailure();
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
@@ -244,6 +250,11 @@ bool DaemonManager::running(NetworkType::Type nettype) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DaemonManager::noSync() const noexcept
|
||||
{
|
||||
return m_noSync;
|
||||
}
|
||||
|
||||
void DaemonManager::runningAsync(NetworkType::Type nettype, const QJSValue& callback) const
|
||||
{
|
||||
m_scheduler.run([this, nettype] {
|
||||
|
||||
@@ -44,9 +44,10 @@ public:
|
||||
|
||||
static DaemonManager * instance(const QStringList *args);
|
||||
|
||||
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "");
|
||||
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
|
||||
Q_INVOKABLE bool stop(NetworkType::Type nettype);
|
||||
|
||||
Q_INVOKABLE bool noSync() const noexcept;
|
||||
// return true if daemon process is started
|
||||
Q_INVOKABLE void runningAsync(NetworkType::Type nettype, const QJSValue& callback) const;
|
||||
// Send daemon command from qml and prints output in console window.
|
||||
@@ -82,6 +83,7 @@ private:
|
||||
QString m_monerod;
|
||||
bool m_has_daemon = true;
|
||||
bool m_app_exit = false;
|
||||
bool m_noSync = false;
|
||||
|
||||
mutable FutureScheduler m_scheduler;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user