Skip to content
Permalink
Browse files
[JENKINS-36871] Correctly detect and report the channel being closed …
…for writing
  • Loading branch information
stephenc committed Aug 3, 2016
1 parent 6449a73 commit 8bb6354a188133ea8568bdb332393251ab6b06c1
Showing 1 changed file with 8 additions and 3 deletions.
@@ -30,6 +30,7 @@
import hudson.remoting.Capability;
import hudson.remoting.Channel;
import hudson.remoting.ChannelBuilder;
import hudson.remoting.ChannelClosedException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -288,10 +289,14 @@ public ByteBufferCommandTransport(Capability remoteCapability) {
@Override
protected void write(ByteBuffer header, ByteBuffer data) throws IOException {
if (isWriteOpen()) {
ChannelApplicationLayer.this.write(header);
ChannelApplicationLayer.this.write(data);
try {
ChannelApplicationLayer.this.write(header);
ChannelApplicationLayer.this.write(data);
} catch (ClosedChannelException e) {
throw new ChannelClosedException(e);
}
} else {
throw new ClosedChannelException();
throw new ChannelClosedException(new ClosedChannelException());
}
}

0 comments on commit 8bb6354

Please sign in to comment.