Class UniqueIpFilter
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.ipfilter.AbstractRemoteAddressFilter<InetSocketAddress>
io.netty.handler.ipfilter.UniqueIpFilter
- All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
This class allows one to ensure that at all times for every IP address there is at most one
Channel connected to the server.-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanaccept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress) This method is called immediately after aChannelgets registered.Methods inherited from class AbstractRemoteAddressFilter
channelAccepted, channelActive, channelRegistered, channelRejectedMethods inherited from class ChannelInboundHandlerAdapter
channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
UniqueIpFilter
public UniqueIpFilter()
-
-
Method Details
-
accept
protected boolean accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress) throws Exception Description copied from class:AbstractRemoteAddressFilterThis method is called immediately after aChannelgets registered.- Specified by:
acceptin classAbstractRemoteAddressFilter<InetSocketAddress>- Returns:
- Return true if connections from this IP address and port should be accepted. False otherwise.
- Throws:
Exception
-