Class SuperPeerClient
java.lang.Object
org.drasyl.peer.connection.client.SuperPeerClient
- All Implemented Interfaces:
AutoCloseable
,DrasylNodeComponent
This class represents the link between
DrasylNode
and the super peer. It is
responsible for maintaining the connection to the super peer and updates the data of the super
peer in PeersManager
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.netty.channel.Channel
protected final BooleanSupplier
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SuperPeerClient
(DrasylConfig config, io.netty.channel.EventLoopGroup workerGroup, BooleanSupplier doNewConnectionsSupplier, DrasylFunction<Endpoint, io.netty.bootstrap.Bootstrap, ClientException> bootstrapSupplier) SuperPeerClient
(DrasylConfig config, Identity identity, PeersManager peersManager, Pipeline pipeline, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, BooleanSupplier doNewConnectionsSupplier) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Stops the component.protected void
failed()
This method is called if a connection was not possible and no further connection attempts will be made.protected org.slf4j.Logger
protected static ClientChannelInitializer
initiateChannelInitializer
(ClientEnvironment environment, Class<? extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> clazz) void
open()
Starts the component.protected boolean
-
Field Details
-
doNewConnectionsSupplier
-
channel
protected io.netty.channel.Channel channel
-
-
Constructor Details
-
SuperPeerClient
protected SuperPeerClient(DrasylConfig config, io.netty.channel.EventLoopGroup workerGroup, BooleanSupplier doNewConnectionsSupplier, DrasylFunction<Endpoint, io.netty.bootstrap.Bootstrap, ClientException> bootstrapSupplier) -
SuperPeerClient
public SuperPeerClient(DrasylConfig config, Identity identity, PeersManager peersManager, Pipeline pipeline, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, BooleanSupplier doNewConnectionsSupplier)
-
-
Method Details
-
getLogger
protected org.slf4j.Logger getLogger() -
open
public void open()Description copied from interface:DrasylNodeComponent
Starts the component.- Specified by:
open
in interfaceDrasylNodeComponent
-
shouldRetry
protected boolean shouldRetry()- Returns:
true
if the client should attempt to reconnect. Otherwisefalse
is returned
-
failed
protected void failed()This method is called if a connection was not possible and no further connection attempts will be made. -
close
public void close()Description copied from interface:DrasylNodeComponent
Stops the component.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDrasylNodeComponent
-
initiateChannelInitializer
protected static ClientChannelInitializer initiateChannelInitializer(ClientEnvironment environment, Class<? extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> clazz) throws ClientException - Throws:
ClientException
-