Class ChannelIdTrackingUnknownChannelReferenceHandler
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler
org.apache.sshd.contrib.common.session.helpers.ChannelIdTrackingUnknownChannelReferenceHandler
- All Implemented Interfaces:
EventListener,ChannelListener,UnknownChannelReferenceHandler,SshdEventListener
public class ChannelIdTrackingUnknownChannelReferenceHandler
extends DefaultUnknownChannelReferenceHandler
implements ChannelListener
Makes sure that the referenced "unknown" channel identifier is one that was assigned in the past.
Note: it relies on the fact that the default
ConnectionService implementation assigns channels
identifiers in ascending order.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AttributeRepository.AttributeKey<Long>static final ChannelIdTrackingUnknownChannelReferenceHandlerFields inherited from class org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler
INSTANCEFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.channel.ChannelListener
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelInitialized(Channel channel) Called to inform about initial setup of a channel via theChannel.init(org.apache.sshd.common.session.ConnectionService, org.apache.sshd.common.session.Session, long)method.handleUnknownChannelCommand(ConnectionService service, byte cmd, long channelId, Buffer buffer) Invoked when the connection service responsible for handling channel messages receives a message intended for an unknown channel.Methods inherited from class org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler
sendFailureResponseMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.common.channel.ChannelListener
channelClosed, channelOpenFailure, channelOpenSuccess, channelStateChanged
-
Field Details
-
LAST_CHANNEL_ID_KEY
-
TRACKER
-
-
Constructor Details
-
ChannelIdTrackingUnknownChannelReferenceHandler
public ChannelIdTrackingUnknownChannelReferenceHandler()
-
-
Method Details
-
channelInitialized
Description copied from interface:ChannelListenerCalled to inform about initial setup of a channel via theChannel.init(org.apache.sshd.common.session.ConnectionService, org.apache.sshd.common.session.Session, long)method. Note: this method is guaranteed to be called before either of theChannelListener.channelOpenSuccess(Channel)orChannelListener.channelOpenFailure(Channel, Throwable)will be called- Specified by:
channelInitializedin interfaceChannelListener- Parameters:
channel- The initializedChannel
-
handleUnknownChannelCommand
public Channel handleUnknownChannelCommand(ConnectionService service, byte cmd, long channelId, Buffer buffer) throws IOException Description copied from interface:UnknownChannelReferenceHandlerInvoked when the connection service responsible for handling channel messages receives a message intended for an unknown channel.- Specified by:
handleUnknownChannelCommandin interfaceUnknownChannelReferenceHandler- Overrides:
handleUnknownChannelCommandin classDefaultUnknownChannelReferenceHandler- Parameters:
service- TheConnectionServiceinstance through which the message was receivedcmd- The requested command identifierchannelId- The (unknown) target channel identifierbuffer- The messageBuffercontaining the rest of the message- Returns:
- The resolved
Channel- ifnullthen the message for the unknown channel is ignored. - Throws:
IOException- If failed to handle the request
-