protected void handleWriteDataSuccess(byte cmd, byte[] data, int off, int len) { Session session = getSession(); try { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); } catch (Throwable e) { if (log.isDebugEnabled()) { log.debug("handleWriteDataSuccess({})[{}] failed ({}) to consume len={}: {}", this, SshConstants.getCommandMessageName(cmd & 0xFF), e.getClass().getSimpleName(), len, e.getMessage()); } session.exceptionCaught(e); } }
protected void handleWriteDataSuccess(byte cmd, byte[] data, int off, int len) { Session session = getSession(); try { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); } catch (Throwable e) { if (log.isDebugEnabled()) { log.debug("handleWriteDataSuccess({})[{}] failed ({}) to consume len={}: {}", this, SshConstants.getCommandMessageName(cmd & 0xFF), e.getClass().getSimpleName(), len, e.getMessage()); } session.exceptionCaught(e); } }
protected Buffer request(Buffer buffer) throws IOException { synchronized (messages) { try { OutputStream outputStream = getInvertedIn(); outputStream.write(buffer.array(), buffer.rpos(), buffer.available()); outputStream.flush(); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(buffer.available()); if (messages.isEmpty()) { messages.wait(); } return messages.poll(); } catch (InterruptedException e) { throw (IOException) new InterruptedIOException("Interrupted while polling for messages").initCause(e); } } }
protected Buffer request(Buffer buffer) throws IOException { synchronized (messages) { try { OutputStream outputStream = getInvertedIn(); outputStream.write(buffer.array(), buffer.rpos(), buffer.available()); outputStream.flush(); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(buffer.available()); if (messages.isEmpty()) { messages.wait(); } return messages.poll(); } catch (InterruptedException e) { throw (IOException) new InterruptedIOException("Interrupted while polling for messages").initCause(e); } } }
@Override protected void doWriteData(byte[] data, int off, long len) throws IOException { // If we're already closing, ignore incoming data if (isClosing()) { return; } ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); if (asyncOut != null) { asyncOut.write(new ByteArrayBuffer(data, off, (int) len)); } else if (out != null) { out.write(data, off, (int) len); out.flush(); if (invertedOut == null) { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); } } else { throw new IllegalStateException("No output stream for channel"); } }
@Override protected void doWriteExtendedData(byte[] data, int off, long len) throws IOException { // If we're already closing, ignore incoming data if (isClosing()) { return; } ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Extended data length exceeds int boundaries: %d", len); if (asyncErr != null) { asyncErr.write(new ByteArrayBuffer(data, off, (int) len)); } else if (err != null) { err.write(data, off, (int) len); err.flush(); if (invertedErr == null) { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); } } else { throw new IllegalStateException("No error stream for channel"); } }
@Override protected void doWriteExtendedData(byte[] data, int off, long len) throws IOException { // If we're already closing, ignore incoming data if (isClosing()) { return; } ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Extended data length exceeds int boundaries: %d", len); if (asyncErr != null) { asyncErr.write(new ByteArrayBuffer(data, off, (int) len)); } else if (err != null) { err.write(data, off, (int) len); err.flush(); if (invertedErr == null) { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); } } else { throw new IllegalStateException("No error stream for channel"); } }
@Override protected void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); pipe.write(data, off, (int) len); pipe.flush(); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); }
@Override protected void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); pipe.write(data, off, (int) len); pipe.flush(); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); }
@Override protected synchronized void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); // use a clone in case data buffer is re-used serverSession.writePacket(ByteArrayBuffer.getCompactClone(data, off, (int) len)); }
@Override protected synchronized void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); int result = Socket.send(socket, data, off, (int) len); if (result < Status.APR_SUCCESS) { throw AgentServerProxy.toIOException(result); } } }
@Override protected synchronized void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); // use a clone in case data buffer is re-used serverSession.writePacket(ByteArrayBuffer.getCompactClone(data, off, (int) len)); }
@Override protected synchronized void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); // Make sure we copy the data as the incoming buffer may be reused Buffer buf = ByteArrayBuffer.getCompactClone(data, off, (int) len); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); serverSession.writePacket(buf); }
@Override protected synchronized void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); int result = Socket.send(socket, data, off, (int) len); if (result < Status.APR_SUCCESS) { throw AgentServerProxy.toIOException(result); } } }
@Override protected synchronized void doWriteData(byte[] data, int off, long len) throws IOException { ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); // Make sure we copy the data as the incoming buffer may be reused Buffer buf = ByteArrayBuffer.getCompactClone(data, off, (int) len); Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(len); serverSession.writePacket(buf); }
@Override protected void doWriteData(byte[] data, int off, long len) throws IOException { // If we're already closing, ignore incoming data if (isClosing()) { return; } ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); if (receiver != null) { int r = receiver.data(this, data, off, (int) len); if (r > 0) { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(r); } } else { ValidateUtils.checkTrue(len <= (Integer.MAX_VALUE - Long.SIZE), "Temporary data length exceeds int boundaries: %d", len); if (tempBuffer == null) { tempBuffer = new ByteArrayBuffer((int) len + Long.SIZE, false); } tempBuffer.putRawBytes(data, off, (int) len); } }
@Override protected void doWriteData(byte[] data, int off, long len) throws IOException { // If we're already closing, ignore incoming data if (isClosing()) { return; } ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len); if (receiver != null) { int r = receiver.data(this, data, off, (int) len); if (r > 0) { Window wLocal = getLocalWindow(); wLocal.consumeAndCheck(r); } } else { ValidateUtils.checkTrue(len <= (Integer.MAX_VALUE - Long.SIZE), "Temporary data length exceeds int boundaries: %d", len); if (tempBuffer == null) { tempBuffer = new ByteArrayBuffer((int) len + Long.SIZE, false); } tempBuffer.putRawBytes(data, off, (int) len); } }
@Override public void operationComplete(IoWriteFuture future) { Session session = channel.getSession(); if (future.isWritten()) { try { Window wLocal = channel.getLocalWindow(); wLocal.consumeAndCheck(bytes.length); } catch (IOException e) { session.exceptionCaught(e); } } else { Throwable t = future.getException(); session.exceptionCaught(t); } } });
@Override public void operationComplete(IoWriteFuture future) { Session session = channel.getSession(); if (future.isWritten()) { try { Window wLocal = channel.getLocalWindow(); wLocal.consumeAndCheck(bytes.length); } catch (IOException e) { session.exceptionCaught(e); } } else { Throwable t = future.getException(); session.exceptionCaught(t); } } });
@Override public void operationComplete(IoWriteFuture future) { Session session = channel.getSession(); if (future.isWritten()) { try { Window wLocal = channel.getLocalWindow(); wLocal.consumeAndCheck(bytes.length); } catch (IOException e) { session.exceptionCaught(e); } } else { Throwable t = future.getException(); session.exceptionCaught(t); } } });