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

public class RelayableMessageGuard extends SimpleChannelOutboundHandler<Message>
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
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RelayableMessageGuard(short messageHopLimit)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    channelWrite0(io.netty.channel.ChannelHandlerContext ctx, Message msg, io.netty.channel.ChannelPromise promise)
    Is called for each message of type SimpleChannelOutboundHandler on the outbound channel.

    Methods inherited from class org.drasyl.peer.connection.handler.SimpleChannelOutboundHandler

    acceptOutboundMessage, write

    Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter

    bind, close, connect, deregister, disconnect, flush, read

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    exceptionCaught, handlerAdded, handlerRemoved