@Override protected void preClose() { if (!isEofSent()) { log.debug("close({}) prevent sending EOF", this); } try { signalChannelClosed(null); } finally { // clear the listeners since we are closing the channel (quicker GC) this.channelListeners.clear(); } IOException err = IoUtils.closeQuietly(getLocalWindow(), getRemoteWindow()); if (err != null) { if (log.isDebugEnabled()) { log.debug("Failed (" + err.getClass().getSimpleName() + ") to pre-close window(s) of " + this + ": " + err.getMessage()); } if (log.isTraceEnabled()) { Throwable[] suppressed = err.getSuppressed(); if (GenericUtils.length(suppressed) > 0) { for (Throwable t : suppressed) { log.trace("Suppressed " + t.getClass().getSimpleName() + ") while pre-close window(s) of " + this + ": " + t.getMessage()); } } } } super.preClose(); }
@Override protected void preClose() { if (!isEofSent()) { log.debug("close({}) prevent sending EOF", this); } try { signalChannelClosed(null); } finally { // clear the listeners since we are closing the channel (quicker GC) this.channelListeners.clear(); // clear the attributes since we close the channel clearAttributes(); } IOException err = IoUtils.closeQuietly(getLocalWindow(), getRemoteWindow()); if (err != null) { if (log.isDebugEnabled()) { log.debug("Failed (" + err.getClass().getSimpleName() + ") to pre-close window(s) of " + this + ": " + err.getMessage()); } if (log.isTraceEnabled()) { Throwable[] suppressed = err.getSuppressed(); if (GenericUtils.length(suppressed) > 0) { for (Throwable t : suppressed) { log.trace("Suppressed " + t.getClass().getSimpleName() + ") while pre-close window(s) of " + this + ": " + t.getMessage()); } } } } super.preClose(); }
protected long validateIncomingDataSize(int cmd, long len /* actually a uint32 */) { if (!BufferUtils.isValidUint32Value(len)) { throw new IllegalArgumentException("Non UINT32 length (" + len + ") for command=" + SshConstants.getCommandMessageName(cmd)); } /* * According to RFC 4254 section 5.1 * * The 'maximum packet size' specifies the maximum size of an * individual data packet that can be sent to the sender * * The local window reflects our preference - i.e., how much our peer * should send at most */ Window wLocal = getLocalWindow(); long maxLocalSize = wLocal.getPacketSize(); /* * The reason for the +4 is that there seems to be some confusion whether * the max. packet size includes the length field or not */ if (len > (maxLocalSize + 4L)) { throw new IllegalStateException("Bad length (" + len + ") " + " for cmd=" + SshConstants.getCommandMessageName(cmd) + " - max. allowed=" + maxLocalSize); } return len; }
protected long validateIncomingDataSize(int cmd, long len /* actually a uint32 */) { if (!BufferUtils.isValidUint32Value(len)) { throw new IllegalArgumentException("Non UINT32 length (" + len + ") for command=" + SshConstants.getCommandMessageName(cmd)); } /* * According to RFC 4254 section 5.1 * * The 'maximum packet size' specifies the maximum size of an * individual data packet that can be sent to the sender * * The local window reflects our preference - i.e., how much our peer * should send at most */ Window wLocal = getLocalWindow(); long maxLocalSize = wLocal.getPacketSize(); /* * The reason for the +4 is that there seems to be some confusion whether * the max. packet size includes the length field or not */ if (len > (maxLocalSize + 4L)) { throw new IllegalStateException("Bad length (" + len + ") " + " for cmd=" + SshConstants.getCommandMessageName(cmd) + " - max. allowed=" + maxLocalSize); } return len; }