From 5ad221d0deb2fa92a50dfd64bea884b61ea706b0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 20 Mar 2013 13:18:12 -0400 Subject: 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. --- Assistant/TransferrerPool.hs | 2 ++ Command/TransferKeys.hs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Assistant/TransferrerPool.hs b/Assistant/TransferrerPool.hs index 69af93773..68ec743f8 100644 --- a/Assistant/TransferrerPool.hs +++ b/Assistant/TransferrerPool.hs @@ -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 diff --git a/Command/TransferKeys.hs b/Command/TransferKeys.hs index 93415d5f3..2114e2278 100644 --- a/Command/TransferKeys.hs +++ b/Command/TransferKeys.hs @@ -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 -- cgit v1.2.3