2 minor fixes to transferkeys, otherwise it was perfect 1st time!
Needed to send a trailing NUL to end a request, and set the read handle non-blocking. Also, set fileSystemEncoding on all handles, since there's a filename in there.
This commit is contained in:
parent
b6d691aff7
commit
2c26bd1c65
2 changed files with 9 additions and 1 deletions
|
@ -62,6 +62,8 @@ mkTransferrer program = do
|
|||
closeFd tread
|
||||
myreadh <- fdToHandle myread
|
||||
mywriteh <- fdToHandle mywrite
|
||||
fileEncoding myreadh
|
||||
fileEncoding mywriteh
|
||||
return $ Transferrer
|
||||
{ transferrerRead = myreadh
|
||||
, transferrerWrite = mywriteh
|
||||
|
|
|
@ -66,7 +66,12 @@ runRequests
|
|||
-> Handle
|
||||
-> (TransferRequest -> Annex Bool)
|
||||
-> Annex ()
|
||||
runRequests readh writeh a = go =<< readrequests
|
||||
runRequests readh writeh a = do
|
||||
liftIO $ do
|
||||
hSetBuffering readh NoBuffering
|
||||
fileEncoding readh
|
||||
fileEncoding writeh
|
||||
go =<< readrequests
|
||||
where
|
||||
go (d:u:k:f:rest) = do
|
||||
case (deserialize d, deserialize u, deserialize k, deserialize f) of
|
||||
|
@ -93,6 +98,7 @@ sendRequest t f h = do
|
|||
, serialize (transferUUID t)
|
||||
, serialize (transferKey t)
|
||||
, serialize f
|
||||
, "" -- adds a trailing null
|
||||
]
|
||||
hFlush h
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue