summaryrefslogtreecommitdiff
path: root/Command/TransferKeys.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-20 13:18:12 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-20 13:24:35 -0400
commit5ad221d0deb2fa92a50dfd64bea884b61ea706b0 (patch)
tree8e11aa51df9f74f0c725608f2eeb85488d5696c3 /Command/TransferKeys.hs
parent4887b1b3afd8acf58602d622499664ffb777a8b1 (diff)
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.
Diffstat (limited to 'Command/TransferKeys.hs')
-rw-r--r--Command/TransferKeys.hs8
1 files changed, 7 insertions, 1 deletions
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