From 3d8205caed9aa1d4cee9b2909492fcf99bfa5fc6 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Mon, 18 Dec 2017 08:30:27 +0100 Subject: [PATCH] Improve method names and log messages. --- AutoTx/AutoTx.cs | 15 ++++++++------- AutoTx/RoboCommand.cs | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index 88f249c..a76f9f1 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -600,15 +600,15 @@ namespace AutoTx // if we're paused, resume the transfer and DO NOTHING ELSE: if (_transferState == TxState.Paused) { - ResumeTransfer(); + ResumePausedTransfer(); return; } // first check if there are finished transfers and clean them up: - CheckFinishedTransfers(); + FinalizeTransfers(); // next check if there is a transfer that has to be resumed: - CheckTransfersToResume(); + ResumeInterruptedTransfer(); // check if any of the above calls changed the transfer state: if (_transferState != TxState.Stopped) @@ -660,7 +660,7 @@ namespace AutoTx /// to the final (user) destination and by locally moving the transferred folders to the /// grace location for deferred deletion. /// </summary> - private void CheckFinishedTransfers() { + private void FinalizeTransfers() { // NOTE: this is intentionally triggered by the timer only to make sure the cleanup // only happens while all system parameters are within their valid ranges @@ -689,9 +689,10 @@ namespace AutoTx } /// <summary> - /// Check if conditions for resuming a transfer are met and do so if true. + /// Check if an interrupted (service shutdown) transfer exists and whether the current + /// state allows for resuming it. /// </summary> - private void CheckTransfersToResume() { + private void ResumeInterruptedTransfer() { // CONDITIONS (a transfer has to be resumed): // - CurrentTargetTmp has to be non-empty // - TransferState has to be "Stopped" @@ -701,7 +702,7 @@ namespace AutoTx _status.TransferInProgress == false) return; - writeLogDebug("Resuming transfer from '" + _status.CurrentTransferSrc + + writeLogDebug("Resuming interrupted transfer from '" + _status.CurrentTransferSrc + "' to '" + ExpandCurrentTargetTmp() + "'"); StartTransfer(_status.CurrentTransferSrc); } diff --git a/AutoTx/RoboCommand.cs b/AutoTx/RoboCommand.cs index f80bb21..fa0233e 100644 --- a/AutoTx/RoboCommand.cs +++ b/AutoTx/RoboCommand.cs @@ -96,12 +96,12 @@ namespace AutoTx /// <summary> /// Resume a previously paused transfer. /// </summary> - private void ResumeTransfer() { + private void ResumePausedTransfer() { // only proceed when in a valid state: if (_transferState != TxState.Paused) return; - writeLog("Resuming the active transfer..."); + writeLog("Resuming the paused transfer..."); _roboCommand.Resume(); _transferState = TxState.Active; writeLogDebug("Transfer resumed"); -- GitLab