/** * Attempts to use the channel attribute, if not found then tries the session * * @param <T> The generic attribute type * @param channel The {@link Channel} - ignored if {@code null} * @param key The attribute key - never {@code null} * @return Associated value - {@code null} if not found * @see #getSession() * @see Session#resolveAttribute(Session, AttributeRepository.AttributeKey) */ static <T> T resolveAttribute(Channel channel, AttributeRepository.AttributeKey<T> key) { Objects.requireNonNull(key, "No key"); if (channel == null) { return null; } T value = channel.getAttribute(key); return (value != null) ? value : Session.resolveAttribute(channel.getSession(), key); } }
/** * Attempts to use the channel attribute, if not found then tries the session * * @param <T> The generic attribute type * @param channel The {@link Channel} - ignored if {@code null} * @param key The attribute key - never {@code null} * @return Associated value - {@code null} if not found * @see #getSession() * @see Session#resolveAttribute(Session, AttributeKey) */ static <T> T resolveAttribute(Channel channel, AttributeKey<T> key) { Objects.requireNonNull(key, "No key"); if (channel == null) { return null; } T value = channel.getAttribute(key); return (value != null) ? value : Session.resolveAttribute(channel.getSession(), key); } }
Session session = channel.getSession(); boolean debugEnabled = log.isDebugEnabled(); boolean traceEnabled = log.isTraceEnabled();
protected void newBuffer(int size) { Channel channel = getChannel(); Session session = channel.getSession(); buffer = session.createBuffer(cmd, size <= 0 ? 12 : 12 + size); buffer.putInt(channel.getRecipient()); if (cmd == SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA) { buffer.putInt(SshConstants.SSH_EXTENDED_DATA_STDERR); } buffer.putInt(0); bufferLength = 0; }
Session session = channel.getSession(); boolean debugEnabled = log.isDebugEnabled(); boolean traceEnabled = log.isTraceEnabled();
protected void newBuffer(int size) { Channel channel = getChannel(); Session session = channel.getSession(); buffer = session.createBuffer(cmd, size <= 0 ? 12 : 12 + size); buffer.putInt(channel.getRecipient()); if (cmd == SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA) { buffer.putInt(SshConstants.SSH_EXTENDED_DATA_STDERR); } buffer.putInt(0); bufferLength = 0; }
wLocal.consumeAndCheck(nbRead); } catch (IOException e) { Session session = channel.getSession(); session.exceptionCaught(e);
wLocal.consumeAndCheck(nbRead); } catch (IOException e) { Session session = channel.getSession(); session.exceptionCaught(e);
Session s = channel.getSession(); Buffer buf = s.createBuffer(cmd, (int) length + 12); buf.putInt(channel.getRecipient());
Session s = channel.getSession(); Buffer buf = s.createBuffer(cmd, (int) length + 12); buf.putInt(channel.getRecipient());