From 1100263e70da68607882e7a63d945e0a1f1fea90 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 21 Nov 2016 19:24:55 -0400 Subject: pull/push over tor working now Still a couple bugs: * Closing the connection to the server leaves git upload-pack / receive-pack running, which could be used to DOS. * Sometimes the data is transferred, but it fails at the end, sometimes with: git-remote-tor-annex: : commitBuffer: resource vanished (Broken pipe) Must be a race condition around shutdown. --- CmdLine/GitRemoteTorAnnex.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'CmdLine') diff --git a/CmdLine/GitRemoteTorAnnex.hs b/CmdLine/GitRemoteTorAnnex.hs index bc001f42f..77fadc63e 100644 --- a/CmdLine/GitRemoteTorAnnex.hs +++ b/CmdLine/GitRemoteTorAnnex.hs @@ -21,9 +21,7 @@ run (_remotename:address:[]) = forever $ do -- gitremote-helpers protocol l <- getLine case l of - "capabilities" -> do - putStrLn "connect" - putStrLn "" + "capabilities" -> putStrLn "connect" >> ready "connect git-upload-pack" -> go UploadPack "connect git-receive-pack" -> go ReceivePack _ -> error $ "git-remote-helpers protocol error at " ++ show l @@ -33,9 +31,12 @@ run (_remotename:address:[]) = forever $ do reverse $ takeWhile (/= '/') $ reverse address | otherwise = parseAddressPort address go service = do + ready + connectService onionaddress onionport service >>= exitWith + ready = do putStrLn "" hFlush stdout - connectService onionaddress onionport service >>= exitWith + run (_remotename:[]) = giveup "remote address not configured" run _ = giveup "expected remote name and address parameters" -- cgit v1.2.3