This commit is contained in:
Joey Hess 2012-01-19 20:41:20 -04:00
parent 7fa95eff5e
commit 3783ccf252

View file

@ -16,3 +16,34 @@ Simple, when performing various git annex command over ssh, in particular a mult
>> >>
>> Complicated slightly by not doing this if the user has already set up >> Complicated slightly by not doing this if the user has already set up
>> more broad ssh connection caching. --[[Joey]] >> more broad ssh connection caching. --[[Joey]]
---
Slightly more elaborate design for using ssh connection caching:
* Per-uuid ssh socket in `.git/annex/ssh/user@host.socket`
* Can be shared amoung concurrent git-annex processes.
* Run ssh like: `ssh -S .git/annex/ssh/user@host.socket -o ControlMaster=auto -o ControlPersist=yes user@host`
* At shutdown, enumerate all existing sockets, and on each:
1. Rename to .old (prevents various races)
2. `ssh -q -S .git/annex/ssh/user@host.old -o ControlMaster=auto -o ControlPersist=yes -O stop user@host`
(Will exit nonzero if ssh is not running on that socket.)
3. And then remove the socket.
* Do same *at startup*. Why? In case an old git-annex was interrupted
and left behind a ssh. May have moved to a different network
in the meantime, etc, and be stalled waiting for a response from the
network, or talking to the wrong interface or something.
(Ie, the reason why I don't use ssh connection caching by default.)
* This would stop ssh's used by a concurrently running git-annex,
but only after they finish servicing their current connection.
Could use locks to detect if another git-annex is using a ssh
socket, but concurrent git-annex is rare enough, and the impact small
enough (next ssh it runs needs to do a full connect), that
the locks are probably not justified. Could be added later if needed tho.
* Could also set ControlPersist to something like "1h", in order to
auto-terminate leftover ssh's when git-annex is ctrl-c'd or somehow
exits. When transferring big enough files that the next ssh doesn't
happen for an hour, the overhead of that ssh needing to reconnect is
not significant.
* User should be able to override this, to use their own preferred
connection caching setup. `annex.sshcaching=false`