Class GoBackNArqReceiverHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
org.drasyl.handler.arq.gobackn.GoBackNArqReceiverHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

public class GoBackNArqReceiverHandler extends io.netty.channel.ChannelDuplexHandler
Performs the Go-Back-N ARQ receiver protocol.

This handler should be used together with GoBackNArqCodec, ByteToGoBackNArqDataCodec and GoBackNArqReceiverHandler.

  ChannelPipeline p = ...;
  ...
  p.addLast("arq_codec", new GoBackNArqCodec());
  p.addLast("arq_snd_handler", new GoBackNArqSenderHandler(150, Duration.ofMillis(100)));
  p.addLast("arg_rec_handler", new GoBackNArqReceiverHandler(Duration.ofMills(100).dividedBy(10)));
  p.addLast("buf_codec", new ByteToGoBackNArqDataCodec());
  ...
  p.addLast("handler", new HttpRequestHandler());
  
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelActive(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    void
    handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
     

    Methods inherited from class io.netty.channel.ChannelDuplexHandler

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

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, 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

    handlerRemoved
  • Constructor Details

    • GoBackNArqReceiverHandler

      public GoBackNArqReceiverHandler(UnsignedInteger nextSequenceNo, Duration ackClock)
      Parameters:
      nextSequenceNo - the next expected inbound sequence number
      ackClock - the frequency of sending ACKs for received packages
    • GoBackNArqReceiverHandler

      public GoBackNArqReceiverHandler(Duration ackClock)
      Parameters:
      ackClock - the frequency of sending ACKs for received packages
  • Method Details

    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • handlerAdded

      public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      handlerAdded in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerAdded in class io.netty.channel.ChannelHandlerAdapter
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception