Class RelayableMessageGuard
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelOutboundHandlerAdapter
org.drasyl.peer.connection.handler.SimpleChannelOutboundHandler<Message>
org.drasyl.peer.connection.handler.RelayableMessageGuard
- All Implemented Interfaces:
 io.netty.channel.ChannelHandler,io.netty.channel.ChannelOutboundHandler
This handler ensures that 
Messages do not infinitely circulate in the network. It
 increments the hop counter of each outgoing message. If the limit of hops is reached, the message
 is discarded. Otherwise the message can pass.- 
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable - 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidchannelWrite0(io.netty.channel.ChannelHandlerContext ctx, Message msg, io.netty.channel.ChannelPromise promise) Is called for each message of typeSimpleChannelOutboundHandleron the outbound channel.Methods inherited from class org.drasyl.peer.connection.handler.SimpleChannelOutboundHandler
acceptOutboundMessage, writeMethods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
exceptionCaught, handlerAdded, handlerRemoved 
- 
Field Details
- 
HOP_COUNT_GUARD
- See Also:
 
 
 - 
 - 
Constructor Details
- 
RelayableMessageGuard
public RelayableMessageGuard(short messageHopLimit)  
 - 
 - 
Method Details
- 
channelWrite0
protected void channelWrite0(io.netty.channel.ChannelHandlerContext ctx, Message msg, io.netty.channel.ChannelPromise promise) Description copied from class:SimpleChannelOutboundHandlerIs called for each message of typeSimpleChannelOutboundHandleron the outbound channel.- Specified by:
 channelWrite0in classSimpleChannelOutboundHandler<Message>- Parameters:
 ctx- theChannelHandlerContextwhich thisSimpleChannelDuplexHandlerbelongs tomsg- the message to handlepromise- the corresponding promise
 
 -