diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-03-22 08:20:39 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-03-22 08:20:39 -0700 |
commit | 8014dbe9bf42489521f58765645bceb90df45e74 (patch) | |
tree | dbbd2a88f1165adca5504325f2131e1ceaca5472 /org.eclipse.jgit | |
parent | 9285240d47cd62ef301fb703beb68c5a22f59692 (diff) | |
parent | 0dc93a2f4ab0c9ef8293c825c393fe0bad8b110a (diff) | |
download | jgit-8014dbe9bf42489521f58765645bceb90df45e74.tar.gz jgit-8014dbe9bf42489521f58765645bceb90df45e74.zip |
Merge branch 'stable-0.7'
* stable-0.7:
Fix EGit deadlock listing branches of SSH remote
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java | 23 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java | 4 |
2 files changed, 26 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java index a2c572c601..7b6d3e121a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java @@ -282,8 +282,10 @@ abstract class BasePackConnection extends BaseConnection { public void close() { if (out != null) { try { - if (outNeedsEnd) + if (outNeedsEnd) { + outNeedsEnd = false; pckOut.end(); + } out.close(); } catch (IOException err) { // Ignore any close errors. @@ -314,4 +316,23 @@ abstract class BasePackConnection extends BaseConnection { } } } + + /** Tell the peer we are disconnecting, if it cares to know. */ + protected void endOut() { + if (outNeedsEnd && out != null) { + try { + outNeedsEnd = false; + pckOut.end(); + } catch (IOException e) { + try { + out.close(); + } catch (IOException err) { + // Ignore any close errors. + } finally { + out = null; + pckOut = null; + } + } + } + } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java index d4d4f5412f..fb2038b862 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java @@ -264,6 +264,8 @@ public class TransportGitSsh extends SshTransport implements PackTransport { @Override public void close() { + endOut(); + if (errorThread != null) { try { errorThread.join(); @@ -331,6 +333,8 @@ public class TransportGitSsh extends SshTransport implements PackTransport { @Override public void close() { + endOut(); + if (errorThread != null) { try { errorThread.join(); |