add connProcess to P2PConnection

When using the new generic P2P transport to open an outgoing connection
to a peer, this will hold the pid of the git-annex-p2p-<netname>
command.

closeConnection simply waits for it. Rather than relying on garbage
collection of the closed handles to close it.

In Remote.Helper.Ssh, connProcess is set to Nothing, even though there
is a similar process being used there. That code stores the pid in
OpenConnection instead, and handles waiting for it itself. A bit ugly,
but not worth cleaning up at this point, maybe later.
This commit is contained in:
Joey Hess 2025-07-30 12:25:59 -04:00
commit a6f8248465
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 13 additions and 2 deletions

View file

@ -406,10 +406,10 @@ mkP2PConnectionPair connparams (n1, n2) = do
(if connectionWaitVar connparams then Just wait2 else Nothing)
closed2
let clientconn = P2PConnection Nothing
(const True) h2 h1
(const True) h2 h1 Nothing
(ConnIdent (Just n1))
let serverconn = P2PConnection Nothing
(const True) h1 h2
(const True) h1 h2 Nothing
(ConnIdent (Just n2))
return (clientconn, serverconn)