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, ConnectionConfig config) ConnectionHandler
(int remotePort, ConnectionConfig config) -
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
channelReadComplete
(io.netty.channel.ChannelHandlerContext ctx) void
close
(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) void
flush
(io.netty.channel.ChannelHandlerContext ctx) void
handlerAdded
(io.netty.channel.ChannelHandlerContext ctx) void
handlerRemoved
(io.netty.channel.ChannelHandlerContext ctx) void
read
(io.netty.channel.ChannelHandlerContext ctx) toString()
void
ABORT call as described in RFC 9293, Section 3.10.5.STATUS call as described in RFC 9293, Section 3.10.6.void
write
(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, connect, deregister, disconnect
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Constructor Details
-
ConnectionHandler
-
ConnectionHandler
-
ConnectionHandler
public ConnectionHandler()
-
-
Method Details
-
toString
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
-
handlerRemoved
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerRemoved
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerRemoved
in classio.netty.channel.ChannelHandlerAdapter
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) - Specified by:
close
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
close
in classio.netty.channel.ChannelDuplexHandler
-
read
public void read(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
read
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
read
in classio.netty.channel.ChannelDuplexHandler
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) - Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.channel.ChannelDuplexHandler
-
flush
public void flush(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
flush
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
flush
in classio.netty.channel.ChannelDuplexHandler
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
-
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
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelReadComplete
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelReadComplete
in 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.
-