aboutsummaryrefslogtreecommitdiff
path: root/P2P/IO.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2018-03-07 15:15:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2018-03-07 15:38:01 -0400
commit9f4771eb3c3f29ea38bbfc70eaf78198ca948840 (patch)
tree254a904d70a593da0c4bcfc4d948d4f9a07d19c2 /P2P/IO.hs
parentb7aa7445a5d97d6f43fbea26ae2ee1773744ebc9 (diff)
implemented git-annex-shell p2pstdio
Not yet used by git-annex, but this will allow faster transfers etc than using individual ssh connections and rsync. Not called git-annex-shell p2p, because git-annex p2p does something else and I don't want two subcommands with the same name between the two for sanity reasons. This commit was sponsored by Øyvind Andersen Holm.
Diffstat (limited to 'P2P/IO.hs')
-rw-r--r--P2P/IO.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/P2P/IO.hs b/P2P/IO.hs
index 9ebb102f1..6cdc5b7d5 100644
--- a/P2P/IO.hs
+++ b/P2P/IO.hs
@@ -10,6 +10,7 @@
module P2P.IO
( RunProto
, P2PConnection(..)
+ , stdioP2PConnection
, connectPeer
, closeConnection
, serveUnixSocket
@@ -50,6 +51,15 @@ data P2PConnection = P2PConnection
, connOhdl :: Handle
}
+-- P2PConnection using stdio.
+stdioP2PConnection :: Git.Repo -> P2PConnection
+stdioP2PConnection g = P2PConnection
+ { connRepo = g
+ , connCheckAuth = const False
+ , connIhdl = stdin
+ , connOhdl = stdout
+ }
+
-- Opens a connection to a peer. Does not authenticate with it.
connectPeer :: Git.Repo -> P2PAddress -> IO P2PConnection
connectPeer g (TorAnnex onionaddress onionport) = do