From 1296cfb09a763878e7b9376f59aabf60fb8d7314 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 28 Aug 2012 14:19:11 -0400 Subject: 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. --- Logs/Transfer.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Logs') 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 -- cgit v1.2.3