Package org.drasyl.handler.arq.gobackn
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", newGoBackNArqCodec
()); p.addLast("arq_snd_handler", newGoBackNArqSenderHandler
(150, Duration.ofMillis(100))); p.addLast("arg_rec_handler", newGoBackNArqReceiverHandler
(Duration.ofMills(100).dividedBy(10))); p.addLast("buf_codec", newByteToGoBackNArqDataCodec
()); ... 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
ConstructorDescriptionGoBackNArqReceiverHandler
(Duration ackClock) GoBackNArqReceiverHandler
(UnsignedInteger nextSequenceNo, Duration ackClock) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
- Parameters:
nextSequenceNo
- the next expected inbound sequence numberackClock
- the frequency of sending ACKs for received packages
-
GoBackNArqReceiverHandler
- Parameters:
ackClock
- the frequency of sending ACKs for received packages
-
-
Method Details
-
channelActive
- Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead
- Specified by:
channelRead
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelRead
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-