Class InternetDiscoveryChildrenHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- org.drasyl.handler.remote.internet.InternetDiscoveryChildrenHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
- Direct Known Subclasses:
TraversingInternetDiscoveryChildrenHandler
public class InternetDiscoveryChildrenHandler extends io.netty.channel.ChannelDuplexHandler
Joins one ore multiple super peer(s) as a children. Uses the super peer with the best latency as a default gateway for outbound messages.- See Also:
InternetDiscoverySuperPeerHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected LongSupplier
currentTime
protected long
maxTimeOffsetMillis
protected int
myNetworkId
protected ProofOfWork
myProofOfWork
protected IdentityPublicKey
myPublicKey
protected DuplicatePathEventFilter
pathEventFilter
protected long
pingTimeoutMillis
protected Map<IdentityPublicKey,org.drasyl.handler.remote.internet.InternetDiscoveryChildrenHandler.SuperPeer>
superPeers
-
Constructor Summary
Constructors Constructor Description InternetDiscoveryChildrenHandler(int myNetworkId, IdentityPublicKey myPublicKey, IdentitySecretKey mySecretKey, ProofOfWork myProofOfWork, long initialPingDelayMillis, long pingIntervalMillis, long pingTimeoutMillis, long maxTimeOffsetMillis, Map<IdentityPublicKey,InetSocketAddress> superPeerAddresses)
InternetDiscoveryChildrenHandler(int myNetworkId, IdentityPublicKey myPublicKey, IdentitySecretKey mySecretKey, ProofOfWork myProofOfWork, LongSupplier currentTime, long initialPingDelayMillis, long pingIntervalMillis, long pingTimeoutMillis, long maxTimeOffsetMillis, Map<IdentityPublicKey,InetSocketAddress> superPeerAddresses)
-
Method Summary
All Methods Instance Methods Concrete Methods 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)
protected boolean
isUnexpectedMessage(Object msg)
void
write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
protected void
writeHelloMessage(io.netty.channel.ChannelHandlerContext ctx, DrasylAddress publicKey, InetSocketAddress inetAddress, boolean isChildrenJoin)
Make sure to callChannel.flush()
by your own!-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
myNetworkId
protected final int myNetworkId
-
myPublicKey
protected final IdentityPublicKey myPublicKey
-
myProofOfWork
protected final ProofOfWork myProofOfWork
-
currentTime
protected final LongSupplier currentTime
-
pingTimeoutMillis
protected final long pingTimeoutMillis
-
maxTimeOffsetMillis
protected final long maxTimeOffsetMillis
-
superPeers
protected final Map<IdentityPublicKey,org.drasyl.handler.remote.internet.InternetDiscoveryChildrenHandler.SuperPeer> superPeers
-
pathEventFilter
protected final DuplicatePathEventFilter pathEventFilter
-
-
Constructor Detail
-
InternetDiscoveryChildrenHandler
public InternetDiscoveryChildrenHandler(int myNetworkId, IdentityPublicKey myPublicKey, IdentitySecretKey mySecretKey, ProofOfWork myProofOfWork, LongSupplier currentTime, long initialPingDelayMillis, long pingIntervalMillis, long pingTimeoutMillis, long maxTimeOffsetMillis, Map<IdentityPublicKey,InetSocketAddress> superPeerAddresses)
-
InternetDiscoveryChildrenHandler
public InternetDiscoveryChildrenHandler(int myNetworkId, IdentityPublicKey myPublicKey, IdentitySecretKey mySecretKey, ProofOfWork myProofOfWork, long initialPingDelayMillis, long pingIntervalMillis, long pingTimeoutMillis, long maxTimeOffsetMillis, Map<IdentityPublicKey,InetSocketAddress> superPeerAddresses)
-
-
Method Detail
-
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
public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
- Specified by:
channelRead
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelRead
in classio.netty.channel.ChannelInboundHandlerAdapter
-
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
-
writeHelloMessage
protected void writeHelloMessage(io.netty.channel.ChannelHandlerContext ctx, DrasylAddress publicKey, InetSocketAddress inetAddress, boolean isChildrenJoin)
Make sure to callChannel.flush()
by your own!
-
isUnexpectedMessage
protected boolean isUnexpectedMessage(Object msg)
-
-