Terminate StreamCopy threads in case of errors

Bug: 513554
Change-Id: I065836b8fc77ade6de92e4a809fcf770a4f793ec
Signed-off-by: Dmitry Neverov <dmitry.neverov@gmail.com>
This commit is contained in:
Dmitry Neverov 2017-03-13 12:05:44 +01:00 committed by David Pursehouse
parent 2bbe15abd4
commit a0a8a6a3e4
2 changed files with 7 additions and 6 deletions

View File

@ -220,6 +220,7 @@ private boolean isRunning() {
public void destroy() {
if (channel.isConnected())
channel.disconnect();
closeOutputStream();
}
@Override

View File

@ -283,12 +283,12 @@ class SshFetchConnection extends BasePackFetchConnection {
init(process.getInputStream(), process.getOutputStream());
} catch (TransportException err) {
close();
throw err;
} catch (IOException err) {
close();
} catch (Throwable err) {
throw new TransportException(uri,
JGitText.get().remoteHungUpUnexpectedly, err);
} finally {
close();
}
try {
@ -341,12 +341,12 @@ class SshPushConnection extends BasePackPushConnection {
init(process.getInputStream(), process.getOutputStream());
} catch (TransportException err) {
close();
throw err;
} catch (IOException err) {
close();
} catch (Throwable err) {
throw new TransportException(uri,
JGitText.get().remoteHungUpUnexpectedly, err);
} finally {
close();
}
try {