Class Server
java.lang.Object
org.drasyl.peer.connection.server.Server
- All Implemented Interfaces:
AutoCloseable
,DrasylNodeComponent
The server binds to a defined port and thus allows the node to be discovered and contacted by
other peers.
-
Constructor Summary
ConstructorsConstructorDescriptionServer
(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, AtomicBoolean opened, BooleanSupplier acceptNewConnectionsSupplier, Set<Endpoint> nodeEndpoints) Server for accepting connections from child peers and non-child peers.Server
(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, Set<Endpoint> nodeEndpoints, BooleanSupplier acceptNewConnectionsSupplier) -
Method Summary
-
Constructor Details
-
Server
public Server(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, Set<Endpoint> nodeEndpoints, BooleanSupplier acceptNewConnectionsSupplier) throws ServerException - Throws:
ServerException
-
Server
public Server(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, AtomicBoolean opened, BooleanSupplier acceptNewConnectionsSupplier, Set<Endpoint> nodeEndpoints) throws ServerException Server for accepting connections from child peers and non-child peers.- Parameters:
identity
- the identity managerpipeline
- the pipeline objectpeersManager
- the peers managerconfig
- config that should be usedchannelGroup
- the channel groupworkerGroup
- netty shared worker groupbossGroup
- netty shared boss groupacceptNewConnectionsSupplier
- the accept new connections suppliernodeEndpoints
- the node endpoints- Throws:
ServerException
-
-
Method Details
-
open
Starts the server.- Specified by:
open
in interfaceDrasylNodeComponent
- Throws:
ServerException
-
close
public void close()Closes the server socket and all open client sockets.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDrasylNodeComponent
-