Reuse the same SSH connection when automatically fetching tags
commit2e0567520121a2faecd271999f29c939d29229bf
authorShawn O. Pearce <spearce@spearce.org>
Thu, 10 Jul 2008 06:13:21 +0000 (10 02:13 -0400)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 11 Jul 2008 10:14:13 +0000 (11 12:14 +0200)
tree7e348bf2a52ce9f18e5fb3306815bbca6f0c4791
parent5f06f169e52e325132edfceaf1866692281bc07c
Reuse the same SSH connection when automatically fetching tags

If we have to open a second connection to git-upload-pack in order
to automatically follow and fetch annotated tags we may be able to
reuse the same JSch Session object and simply run the second stream
over the already established, encrypted TCP stream.

Reusing the Session avoids the overheads associated with performing
public/private key authentication and reduces the overall latency
of the fetch process.

To make reuse work we cache the Session at the Transport instance
level and ask Transport API users to close the Transport once they
are completely done talking to this remote repository.  While the
Transport instance is unclosed however multiple FetchConnection
and/or PushConnections can be established, with each subsequent
connection being cheaper to setup.

In the future we may also support reusing the same Session onto
different Transport instances, permitting access to multiple
repositories hosted on the same remote SSH server.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 files changed:
org.spearce.egit.core/src/org/spearce/egit/core/op/CloneOperation.java
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/SourceBranchPage.java
org.spearce.jgit.test/tst/org/spearce/jgit/transport/PushProcessTest.java
org.spearce.jgit.test/tst/org/spearce/jgit/transport/TransportTest.java
org.spearce.jgit/src/org/spearce/jgit/pgm/Fetch.java
org.spearce.jgit/src/org/spearce/jgit/pgm/LsRemote.java
org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportAmazonS3.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportBundle.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitAnon.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportGitSsh.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportLocal.java
org.spearce.jgit/src/org/spearce/jgit/transport/TransportSftp.java