@Override public synchronized IoWriteFuture writePacket(Buffer buffer) throws IOException { if (isClosing()) { throw new EOFException("Closed"); } IoWriteFutureImpl future = new IoWriteFutureImpl(packetWriteId, buffer); if (!pendingWrite.compareAndSet(null, future)) { throw new WritePendingException("No write pending future"); } doWriteIfPossible(false); return future; }
@Override public String toString() { return getClass().getSimpleName() + "[" + getChannel() + "] cmd=" + SshConstants.getCommandMessageName(cmd & 0xFF); } }
@Override public void handleWindowAdjust(Buffer buffer) throws IOException { super.handleWindowAdjust(buffer); if (asyncOut != null) { asyncOut.onWindowExpanded(); } }
@Override protected void doOpen() throws IOException { if (streaming == Streaming.Async) { asyncIn = new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_DATA); asyncOut = new ChannelAsyncInputStream(this); } else { out = new ChannelOutputStream(this, getRemoteWindow(), log, SshConstants.SSH_MSG_CHANNEL_DATA, true); invertedIn = out; ChannelPipedInputStream pis = new ChannelPipedInputStream(this, getLocalWindow()); pipe = new ChannelPipedOutputStream(pis); in = pis; invertedOut = in; } }
public void onWindowExpanded() throws IOException { doWriteIfPossible(true); }
@SuppressWarnings("synthetic-access") @Override protected CloseFuture doCloseGracefully() { try { sendEof(); } catch (IOException e) { Session session = getSession(); session.exceptionCaught(e); } return super.doCloseGracefully(); } };
@Override protected CloseFuture doCloseGracefully() { return builder().when(pendingWrite.get()).build().close(false); }
@Override protected void doOpen() throws IOException { if (streaming == Streaming.Async) { asyncIn = new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_DATA); asyncOut = new ChannelAsyncInputStream(this); } else { out = new ChannelOutputStream(this, getRemoteWindow(), log, SshConstants.SSH_MSG_CHANNEL_DATA, true); invertedIn = out; ChannelPipedInputStream pis = new ChannelPipedInputStream(this, getLocalWindow()); pipe = new ChannelPipedOutputStream(pis); in = pis; invertedOut = in; } }
public void onWindowExpanded() throws IOException { doWriteIfPossible(true); }
@SuppressWarnings("synthetic-access") @Override protected CloseFuture doCloseGracefully() { try { sendEof(); } catch (IOException e) { Session session = getSession(); session.exceptionCaught(e); } return super.doCloseGracefully(); } };
@Override protected CloseFuture doCloseGracefully() { return builder().when(pendingWrite.get()).build().close(false); }
@Override public synchronized IoWriteFuture writePacket(Buffer buffer) throws IOException { if (isClosing()) { throw new EOFException("Closed"); } IoWriteFutureImpl future = new IoWriteFutureImpl(packetWriteId, buffer); if (!pendingWrite.compareAndSet(null, future)) { throw new WritePendingException("No write pending future"); } doWriteIfPossible(false); return future; }
asyncOut = new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_DATA); asyncErr = new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA); ((AsyncCommand) command).setIoOutputStream(asyncOut); ((AsyncCommand) command).setIoErrorStream(asyncErr);
@Override public String toString() { return getClass().getSimpleName() + "[" + getChannel() + "] cmd=" + SshConstants.getCommandMessageName(cmd & 0xFF); } }
@Override public void handleWindowAdjust(Buffer buffer) throws IOException { super.handleWindowAdjust(buffer); if (asyncOut != null) { asyncOut.onWindowExpanded(); } }
@SuppressWarnings("synthetic-access") private void handleOperationCompleted() { if (total > length) { if (log.isTraceEnabled()) { log.trace("doWriteIfPossible({}) completed write of {} out of {}", stream, length, total); } doWriteIfPossible(false); } else { boolean nullified = pendingWrite.compareAndSet(future, null); if (log.isTraceEnabled()) { log.trace("doWriteIfPossible({}) completed write len={}, more={}", stream, total, !nullified); } future.setValue(Boolean.TRUE); } }
asyncOut = new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_DATA); asyncErr = new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA); ((AsyncCommand) command).setIoOutputStream(asyncOut); ((AsyncCommand) command).setIoErrorStream(asyncErr);
int total = buffer.available(); if (total > 0) { Channel channel = getChannel(); Window remoteWindow = channel.getRemoteWindow(); long length = Math.min(Math.min(remoteWindow.getSize(), total), remoteWindow.getPacketSize());
@Override public void handleWindowAdjust(Buffer buffer) throws IOException { super.handleWindowAdjust(buffer); if (asyncIn != null) { asyncIn.onWindowExpanded(); } }
@SuppressWarnings("synthetic-access") private void handleOperationCompleted() { if (total > length) { if (log.isTraceEnabled()) { log.trace("doWriteIfPossible({}) completed write of {} out of {}", stream, length, total); } doWriteIfPossible(false); } else { boolean nullified = pendingWrite.compareAndSet(future, null); if (log.isTraceEnabled()) { log.trace("doWriteIfPossible({}) completed write len={}, more={}", stream, total, !nullified); } future.setValue(Boolean.TRUE); } }