Home / Function/ channelInactive() — netty Function Reference

channelInactive() — netty Function Reference

Architecture documentation for the channelInactive() function in SslHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ee9ebef7_de5e_961a_f4a2_5ce80b4344bd["channelInactive()"]
  d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1["SslHandler"]
  ee9ebef7_de5e_961a_f4a2_5ce80b4344bd -->|defined in| d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1
  52f75d24_7c2b_f055_d7e7_b2cfcc304a7f["isStateSet()"]
  ee9ebef7_de5e_961a_f4a2_5ce80b4344bd -->|calls| 52f75d24_7c2b_f055_d7e7_b2cfcc304a7f
  23ca304b_58b0_41b7_c5ca_0810728d5ede["setHandshakeFailure()"]
  ee9ebef7_de5e_961a_f4a2_5ce80b4344bd -->|calls| 23ca304b_58b0_41b7_c5ca_0810728d5ede
  b9490323_35d0_98b8_338b_728f1490d032["notifyClosePromise()"]
  ee9ebef7_de5e_961a_f4a2_5ce80b4344bd -->|calls| b9490323_35d0_98b8_338b_728f1490d032
  style ee9ebef7_de5e_961a_f4a2_5ce80b4344bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/SslHandler.java lines 1180–1214

    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        boolean handshakeFailed = handshakePromise.cause() != null;

        // Channel closed, we will generate 'ClosedChannelException' now.
        ClosedChannelException exception = new ClosedChannelException();

        // Add a supressed exception if the handshake was not completed yet.
        if (isStateSet(STATE_HANDSHAKE_STARTED) && !handshakePromise.isDone()) {
            ThrowableUtil.addSuppressed(exception, StacklessSSLHandshakeException.newInstance(
                    "Connection closed while SSL/TLS handshake was in progress",
                    SslHandler.class, "channelInactive"));
        }

        // Make sure to release SSLEngine,
        // and notify the handshake future if the connection has been closed during handshake.
        setHandshakeFailure(ctx, exception, !isStateSet(STATE_OUTBOUND_CLOSED), isStateSet(STATE_HANDSHAKE_STARTED),
                false);

        // Ensure we always notify the sslClosePromise as well
        notifyClosePromise(exception);

        try {
            super.channelInactive(ctx);
        } catch (DecoderException e) {
            if (!handshakeFailed || !(e.getCause() instanceof SSLException)) {
                // We only rethrow the exception if the handshake did not fail before channelInactive(...) was called
                // as otherwise this may produce duplicated failures as super.channelInactive(...) will also call
                // channelRead(...).
                //
                // See https://github.com/netty/netty/issues/10119
                throw e;
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does channelInactive() do?
channelInactive() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java.
Where is channelInactive() defined?
channelInactive() is defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java at line 1180.
What does channelInactive() call?
channelInactive() calls 3 function(s): isStateSet, notifyClosePromise, setHandshakeFailure.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free