aboutsummaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-28 14:19:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-28 14:19:11 -0400
commit1296cfb09a763878e7b9376f59aabf60fb8d7314 (patch)
tree01123e18dd0ae4419100f75cca2036387179e0c8 /Logs
parent7024a973b222c32f44a7168532afae520e7474ed (diff)
avoid possibly re-adding a removed transfer when updating its info
Doesn't fix the bug I thought it'd fix, but is clearly correct.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Transfer.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index a10ffa7d7..b8938ee69 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -215,6 +215,14 @@ readTransferInfo mpid s =
(bits, filebits) = splitAt 1 $ lines s
filename = join "\n" filebits
+{- Preserves the old transferTid and transferPaused values,
+ - which are not written to disk. -}
+mergeTransferInfo :: TransferInfo -> TransferInfo -> TransferInfo
+mergeTransferInfo new old = new
+ { transferTid = maybe (transferTid new) Just (transferTid old)
+ , transferPaused = transferPaused new || transferPaused old
+ }
+
parsePOSIXTime :: String -> Maybe POSIXTime
parsePOSIXTime s = utcTimeToPOSIXSeconds
<$> parseTime defaultTimeLocale "%s%Qs" s