mirror of
https://github.com/monero-project/monero-gui
synced 2024-12-22 03:15:52 +01:00
SimpleMode: use connection timer 'running' prop, fix daemon restart
This commit is contained in:
parent
4141832a4d
commit
37a8bcb525
30
main.qml
30
main.qml
@ -67,6 +67,7 @@ ApplicationWindow {
|
|||||||
property bool walletSynced: false
|
property bool walletSynced: false
|
||||||
property int maxWindowHeight: (isAndroid || isIOS)? screenHeight : (screenHeight < 900)? 720 : 800;
|
property int maxWindowHeight: (isAndroid || isIOS)? screenHeight : (screenHeight < 900)? 720 : 800;
|
||||||
property bool daemonRunning: !persistentSettings.useRemoteNode && !disconnected
|
property bool daemonRunning: !persistentSettings.useRemoteNode && !disconnected
|
||||||
|
property bool daemonStartStopInProgress: false
|
||||||
property alias toolTip: toolTip
|
property alias toolTip: toolTip
|
||||||
property string walletName
|
property string walletName
|
||||||
property bool viewOnly: false
|
property bool viewOnly: false
|
||||||
@ -251,7 +252,6 @@ ApplicationWindow {
|
|||||||
|
|
||||||
// enable timers
|
// enable timers
|
||||||
userInActivityTimer.running = true;
|
userInActivityTimer.running = true;
|
||||||
simpleModeConnectionTimer.running = true;
|
|
||||||
|
|
||||||
// wallet already opened with wizard, we just need to initialize it
|
// wallet already opened with wizard, we just need to initialize it
|
||||||
var wallet_path = persistentSettings.wallet_path;
|
var wallet_path = persistentSettings.wallet_path;
|
||||||
@ -471,9 +471,6 @@ ApplicationWindow {
|
|||||||
middlePanel.updateStatus();
|
middlePanel.updateStatus();
|
||||||
leftPanel.networkStatus.connected = status
|
leftPanel.networkStatus.connected = status
|
||||||
|
|
||||||
// Update fee multiplier dropdown on transfer page
|
|
||||||
middlePanel.transferView.updatePriorityDropdown();
|
|
||||||
|
|
||||||
// If wallet isnt connected, advanced wallet mode and no daemon is running - Ask
|
// If wallet isnt connected, advanced wallet mode and no daemon is running - Ask
|
||||||
if (appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode && !walletInitialized && disconnected) {
|
if (appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode && !walletInitialized && disconnected) {
|
||||||
daemonManager.runningAsync(persistentSettings.nettype, function(running) {
|
daemonManager.runningAsync(persistentSettings.nettype, function(running) {
|
||||||
@ -661,12 +658,11 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startDaemon(flags){
|
function startDaemon(flags){
|
||||||
|
daemonStartStopInProgress = true;
|
||||||
|
|
||||||
// Pause refresh while starting daemon
|
// Pause refresh while starting daemon
|
||||||
currentWallet.pauseRefresh();
|
currentWallet.pauseRefresh();
|
||||||
|
|
||||||
// Pause simplemode connection timer
|
|
||||||
simpleModeConnectionTimer.stop();
|
|
||||||
|
|
||||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
|
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
|
||||||
const noSync = appWindow.walletMode === 0;
|
const noSync = appWindow.walletMode === 0;
|
||||||
const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress
|
const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress
|
||||||
@ -674,8 +670,10 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stopDaemon(callback){
|
function stopDaemon(callback){
|
||||||
|
daemonStartStopInProgress = true;
|
||||||
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
|
||||||
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
|
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
|
||||||
|
daemonStartStopInProgress = false;
|
||||||
hideProcessingSplash();
|
hideProcessingSplash();
|
||||||
callback(result);
|
callback(result);
|
||||||
});
|
});
|
||||||
@ -683,13 +681,13 @@ ApplicationWindow {
|
|||||||
|
|
||||||
function onDaemonStarted(){
|
function onDaemonStarted(){
|
||||||
console.log("daemon started");
|
console.log("daemon started");
|
||||||
|
daemonStartStopInProgress = false;
|
||||||
hideProcessingSplash();
|
hideProcessingSplash();
|
||||||
currentWallet.connected(true);
|
currentWallet.connected(true);
|
||||||
// resume refresh
|
// resume refresh
|
||||||
currentWallet.startRefresh();
|
currentWallet.startRefresh();
|
||||||
// resume simplemode connection timer
|
// resume simplemode connection timer
|
||||||
appWindow.disconnectedEpoch = Utils.epoch();
|
appWindow.disconnectedEpoch = Utils.epoch();
|
||||||
simpleModeConnectionTimer.start();
|
|
||||||
}
|
}
|
||||||
function onDaemonStopped(){
|
function onDaemonStopped(){
|
||||||
currentWallet.connected(true);
|
currentWallet.connected(true);
|
||||||
@ -697,6 +695,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
function onDaemonStartFailure(error) {
|
function onDaemonStartFailure(error) {
|
||||||
console.log("daemon start failed");
|
console.log("daemon start failed");
|
||||||
|
daemonStartStopInProgress = false;
|
||||||
hideProcessingSplash();
|
hideProcessingSplash();
|
||||||
// resume refresh
|
// resume refresh
|
||||||
currentWallet.startRefresh();
|
currentWallet.startRefresh();
|
||||||
@ -1106,7 +1105,6 @@ ApplicationWindow {
|
|||||||
middlePanel.receiveView.clearFields();
|
middlePanel.receiveView.clearFields();
|
||||||
// disable timers
|
// disable timers
|
||||||
userInActivityTimer.running = false;
|
userInActivityTimer.running = false;
|
||||||
simpleModeConnectionTimer.running = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1854,9 +1852,6 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkSimpleModeConnection(){
|
function checkSimpleModeConnection(){
|
||||||
// auto-connection mechanism for simple mode
|
|
||||||
if(appWindow.walletMode >= 2) return;
|
|
||||||
|
|
||||||
const disconnectedTimeoutSec = 30;
|
const disconnectedTimeoutSec = 30;
|
||||||
const firstCheckDelaySec = 2;
|
const firstCheckDelaySec = 2;
|
||||||
|
|
||||||
@ -1873,15 +1868,20 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (appWindow.daemonRunning) {
|
if (appWindow.daemonRunning) {
|
||||||
appWindow.stopDaemon();
|
appWindow.stopDaemon(function() {
|
||||||
|
appWindow.startDaemon("")
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
appWindow.startDaemon("");
|
||||||
}
|
}
|
||||||
appWindow.startDaemon("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
// Simple mode connection check timer
|
// Simple mode connection check timer
|
||||||
id: simpleModeConnectionTimer
|
id: simpleModeConnectionTimer
|
||||||
interval: 2000; running: false; repeat: true
|
interval: 2000
|
||||||
|
running: appWindow.walletMode < 2 && currentWallet != undefined && !daemonStartStopInProgress
|
||||||
|
repeat: true
|
||||||
onTriggered: appWindow.checkSimpleModeConnection()
|
onTriggered: appWindow.checkSimpleModeConnection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user