use of io.xdag.net.handler.XdagBlockHandler in project xdagj by XDagger.
the class Libp2pXdagProtocol method initChannel.
@NotNull
@Override
public CompletableFuture<Libp2pXdagController> initChannel(@NotNull P2PChannel p2PChannel, @NotNull String s) {
final Connection connection = ((io.libp2p.core.Stream) p2PChannel).getConnection();
libp2pChannel = new Libp2pChannel(connection, this, kernel);
channelManager.add(libp2pChannel);
blockHandler = new XdagBlockHandler(libp2pChannel);
blockHandler.setMessageFactory(new Xdag03MessageFactory());
channelManager.onChannelActive(libp2pChannel, libp2pChannel.getNode());
MessageCodes messageCodes = new MessageCodes();
libp2PXdagController = new Libp2pXdagController(kernel, libp2pChannel);
// add handler
p2PChannel.pushHandler(blockHandler);
p2PChannel.pushHandler(messageCodes);
p2PChannel.pushHandler(libp2PXdagController);
return libp2PXdagController.activeFuture;
}
use of io.xdag.net.handler.XdagBlockHandler in project xdagj by XDagger.
the class XdagChannel method init.
public void init(ChannelPipeline pipeline, Kernel kernel, boolean isServer, InetSocketAddress inetSocketAddress) {
this.kernel = kernel;
this.inetSocketAddress = inetSocketAddress;
this.handshakeHandler = new XdagHandshakeHandler(kernel, this);
handshakeHandler.setServer(isServer);
pipeline.addLast("handshakeHandler", handshakeHandler);
this.messageQueue = new MessageQueue(this);
this.messageCodec = new MessageCodes();
this.blockHandler = new XdagBlockHandler(this);
this.xdagHandlerFactory = new XdagHandlerFactoryImpl(kernel, this);
}
Aggregations