aboutsummaryrefslogtreecommitdiff
path: root/CmdLine
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-11-21 19:24:55 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-11-21 19:24:55 -0400
commit1100263e70da68607882e7a63d945e0a1f1fea90 (patch)
tree6f845352f3c3dd2fc155685d77ca952a5a9827db /CmdLine
parent01bf227ad1d9bd30d6fad2dc104b264a1f55c2c4 (diff)
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: <socket: 10>: commitBuffer: resource vanished (Broken pipe) Must be a race condition around shutdown.
Diffstat (limited to 'CmdLine')
-rw-r--r--CmdLine/GitRemoteTorAnnex.hs9
1 files changed, 5 insertions, 4 deletions
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"