private void shutdownOutputRequested(TlsChildChannel tlsChildChannel, ChannelFuture tlsFuture) { SslHandler tlsHandler = transport.getPipeline().get(SslHandler.class); if (tlsChildChannel.isReadClosed()) { chainFutures(shutdownOutputOrClose(transport), tlsFuture); } else if (tlsHandler != null) { ChannelFuture tlsCloseFuture = tlsHandler.close(); tlsCloseFuture.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (tlsChildChannel.setWriteClosed()) { fireOutputShutdown(tlsChildChannel); fireChannelDisconnected(tlsChildChannel); fireChannelUnbound(tlsChildChannel); fireChannelClosed(tlsChildChannel); } else { fireOutputShutdown(tlsChildChannel); } } }); tlsHandler.getSSLEngineInboundCloseFuture().addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { shutdownOutputOrClose(transport); } }); chainFutures(tlsCloseFuture, tlsFuture); } }
public synchronized void close() { if (closed) { return; } SslHandler sslHandler = (SslHandler)channel.getPipeline().get("ssl"); if (sslHandler != null) { try { ChannelFuture sslCloseFuture = sslHandler.close(); if (!sslCloseFuture.awaitUninterruptibly(10000)) { NettyConnection.log.warn("Timed out waiting for ssl close future to complete"); } } catch (Throwable t) { // ignore } } ChannelFuture closeFuture = channel.close(); if (!closeFuture.awaitUninterruptibly(10000)) { NettyConnection.log.warn("Timed out waiting for channel to close"); } closed = true; listener.connectionDestroyed(getID()); }
private void shutdownOutputRequested(TlsClientChannel tlsClientChannel, ChannelFuture tlsFuture) { SslHandler tlsHandler = transport.getPipeline().get(SslHandler.class); if (tlsClientChannel.isReadClosed()) { chainFutures(shutdownOutputOrClose(transport), tlsFuture); } else if (tlsHandler != null) { ChannelFuture tlsCloseFuture = tlsHandler.close(); tlsCloseFuture.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (tlsClientChannel.setWriteClosed()) { fireOutputShutdown(tlsClientChannel); fireChannelDisconnected(tlsClientChannel); fireChannelUnbound(tlsClientChannel); fireChannelClosed(tlsClientChannel); } else { fireOutputShutdown(tlsClientChannel); } } }); tlsHandler.getSSLEngineInboundCloseFuture().addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { shutdownOutputOrClose(transport); } }); chainFutures(tlsCloseFuture, tlsFuture); } }