run file transfers in threads, not processes

This should fix OSX/BSD issues with not noticing transfer information
files with kqueue. Now that threads are used, the thread can manage the
transfer slot allocation and deallocation by itself; much cleaner.
This commit is contained in:
Joey Hess 2012-07-18 19:13:56 -04:00
parent eea0a3616c
commit cf47bb3f50
7 changed files with 29 additions and 53 deletions

View file

@ -43,7 +43,6 @@ data TransferInfo = TransferInfo
, transferRemote :: Maybe Remote
, bytesComplete :: Maybe Integer
, associatedFile :: Maybe FilePath
, shouldWait :: Bool
}
deriving (Show, Eq, Ord)
@ -87,7 +86,6 @@ transfer t file a = do
<*> pure Nothing -- not 0; transfer may be resuming
<*> pure Nothing
<*> pure file
<*> pure False
bracketIO (prep tfile mode info) (cleanup tfile) a
where
prep tfile mode info = do
@ -180,7 +178,6 @@ readTransferInfo pid s =
<*> pure Nothing
<*> pure Nothing
<*> pure (if null filename then Nothing else Just filename)
<*> pure False
_ -> Nothing
where
(bits, filebits) = splitAt 1 $ lines s