Search in sources :

Example 1 with CellCommandListener

use of dmg.cells.nucleus.CellCommandListener in project dcache by dCache.

the class NettyLineBasedDoor method start.

protected void start(ChannelHandlerContext ctx) throws Exception {
    LineWriter writer = ctx::writeAndFlush;
    clientAddress = remoteAddress.getAddress().getHostAddress();
    LOGGER.debug("Client host: {}", clientAddress);
    interpreter = factory.create(this, getNucleus().getThisAddress(), remoteAddress, proxyAddress, localAddress, writer, executor, poolManager, idResolverFactory, spaceDescriptionCache, spaceLookupCache);
    if (interpreter instanceof CellCommandListener) {
        addCommandListener(interpreter);
    }
    if (interpreter instanceof CellMessageReceiver) {
        addMessageListener((CellMessageReceiver) interpreter);
    }
    if (interpreter instanceof TlsStarter) {
        ((TlsStarter) interpreter).setTlsStarter(e -> {
            e.setUseClientMode(false);
            ctx.pipeline().addFirst("tls", new SslHandler(e, true));
        });
    }
    // Blocking to prevent that we process any commands before the cell is alive
    start().get();
}
Also used : LineWriter(dmg.util.LineWriter) CellMessageReceiver(dmg.cells.nucleus.CellMessageReceiver) CellCommandListener(dmg.cells.nucleus.CellCommandListener) SslHandler(io.netty.handler.ssl.SslHandler)

Aggregations

CellCommandListener (dmg.cells.nucleus.CellCommandListener)1 CellMessageReceiver (dmg.cells.nucleus.CellMessageReceiver)1 LineWriter (dmg.util.LineWriter)1 SslHandler (io.netty.handler.ssl.SslHandler)1