mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 07:40:55 +03:00
Add checks for Channel.isOpen to ChannelOutputStream (Fixes #440)
This commit is contained in:
@@ -150,7 +150,8 @@ public final class ChannelOutputStream extends OutputStream implements ErrorNoti
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkClose() throws SSHException {
|
private void checkClose() throws SSHException {
|
||||||
if (closed) {
|
// Check whether either the Stream is closed, or the underlying channel is closed
|
||||||
|
if (closed || !chan.isOpen()) {
|
||||||
if (error != null)
|
if (error != null)
|
||||||
throw error;
|
throw error;
|
||||||
else
|
else
|
||||||
@@ -160,7 +161,8 @@ public final class ChannelOutputStream extends OutputStream implements ErrorNoti
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() throws IOException {
|
public synchronized void close() throws IOException {
|
||||||
if (!closed) {
|
// Not closed yet, and underlying channel is open to flush the data to.
|
||||||
|
if (!closed && chan.isOpen()) {
|
||||||
try {
|
try {
|
||||||
buffer.flush(false);
|
buffer.flush(false);
|
||||||
// trans.write(new SSHPacket(Message.CHANNEL_EOF).putUInt32(chan.getRecipient()));
|
// trans.write(new SSHPacket(Message.CHANNEL_EOF).putUInt32(chan.getRecipient()));
|
||||||
|
|||||||
Reference in New Issue
Block a user