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.
ChannelPipelinep = ...; ... 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
ConstructorsConstructorDescriptionGoBackNArqReceiverHandler(Duration ackClock) GoBackNArqReceiverHandler(UnsignedInteger nextSequenceNo, Duration ackClock) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read, writeMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, 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
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:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-