Package org.drasyl.handler.connection
Class ConnectionHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
org.drasyl.handler.connection.ConnectionHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class ConnectionHandler
extends io.netty.channel.ChannelDuplexHandler
This handler provides reliable and ordered delivery of bytes between hosts. The protocol is
heavily inspired by the Transmission Control Protocol (TCP), but neither implement all features
nor it is compatible with it.
This handler mainly implements RFC 9293 Transmission Control Protocol (TCP), but also includes TCP Timestamps Option and RTTM Mechanism as described in RFC 7323 TCP Extensions for High Performance. Furthermore, the congestion control algorithms slow start, congestion avoidance, fast retransmit, and fast recovery as described in RFC 5681 TCP Congestion Control are implemented as well.
The Nagle algorithm is used as "Silly Window Syndrome" avoidance algorithm. To improve performance of recovering from multiple losses, the RFC 2018 TCP Selective Acknowledgment Options is used in conjunction with .
The handler can be configured to perform an active or passive OPEN process.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionConnectionHandler(int requestedLocalPort, int remotePort) ConnectionHandler(int requestedLocalPort, int remotePort, ConnectionConfig config) ConnectionHandler(int remotePort, ConnectionConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx) voidclose(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) voidflush(io.netty.channel.ChannelHandlerContext ctx) voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx) voidhandlerRemoved(io.netty.channel.ChannelHandlerContext ctx) voidread(io.netty.channel.ChannelHandlerContext ctx) toString()voidABORT call as described in RFC 9293, Section 3.10.5.STATUS call as described in RFC 9293, Section 3.10.6.voidwrite(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, connect, deregister, disconnectMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Constructor Details
-
ConnectionHandler
-
ConnectionHandler
public ConnectionHandler(int requestedLocalPort, int remotePort) -
ConnectionHandler
-
ConnectionHandler
public ConnectionHandler()
-
-
Method Details
-
toString
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter
-
handlerRemoved
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerRemovedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerRemovedin classio.netty.channel.ChannelHandlerAdapter
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) - Specified by:
closein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
closein classio.netty.channel.ChannelDuplexHandler
-
read
public void read(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
readin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
readin classio.netty.channel.ChannelDuplexHandler
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) - Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
writein classio.netty.channel.ChannelDuplexHandler
-
flush
public void flush(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
flushin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
flushin classio.netty.channel.ChannelDuplexHandler
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter
-
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
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classio.netty.channel.ChannelInboundHandlerAdapter
-
userCallAbort
public void userCallAbort()ABORT call as described in RFC 9293, Section 3.10.5. -
userCallStatus
STATUS call as described in RFC 9293, Section 3.10.6.
-