From e96726caa31fd76413b450790860611f71d13915 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Jan 2012 21:15:13 -0400 Subject: better design Avoids possible repeated password prompts, at the cost of a small bit of locking complication. --- ..._repeated_password_prompts_for_one_command.mdwn | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'doc') diff --git a/doc/todo/wishlist:_Prevent_repeated_password_prompts_for_one_command.mdwn b/doc/todo/wishlist:_Prevent_repeated_password_prompts_for_one_command.mdwn index e5b5e3c5c..a047370ac 100644 --- a/doc/todo/wishlist:_Prevent_repeated_password_prompts_for_one_command.mdwn +++ b/doc/todo/wishlist:_Prevent_repeated_password_prompts_for_one_command.mdwn @@ -22,28 +22,22 @@ Simple, when performing various git annex command over ssh, in particular a mult 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. +* Can be shared amoung concurrent git-annex processes as well as ssh + invocations inside the current git-annex. +* Also a lock file, `.git/annex/ssh/user@host.lock`. + Open and take shared lock before running ssh; store lock in lock pool. + (Not locking socket directly, because ssh might want to.) * 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` + 1. Drop any shared lock. + 2. Attempt to take an exclusive lock (non-blocking). + 3. `ssh -q -S .git/annex/ssh/user@host.socket -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. + 4. And then remove the socket and the lock file. * 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` -- cgit v1.2.3