Home / Function/ closeOutboundAndChannel() — netty Function Reference

closeOutboundAndChannel() — netty Function Reference

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

Function java Buffer Allocators calls 6 called by 2

Entity Profile

Dependency Diagram

graph TD
  22b36647_11f2_7260_1e39_2e07c2db7166["closeOutboundAndChannel()"]
  d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1["SslHandler"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|defined in| d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1
  55fc1fa0_09b4_6a1d_6cb5_2f2eae58c628["disconnect()"]
  55fc1fa0_09b4_6a1d_6cb5_2f2eae58c628 -->|calls| 22b36647_11f2_7260_1e39_2e07c2db7166
  49028cb7_a127_0716_20ed_4fc1e1c7c988["close()"]
  49028cb7_a127_0716_20ed_4fc1e1c7c988 -->|calls| 22b36647_11f2_7260_1e39_2e07c2db7166
  586d9480_c5dd_d8c2_fcc9_bd16fdeca640["setState()"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|calls| 586d9480_c5dd_d8c2_fcc9_bd16fdeca640
  55fc1fa0_09b4_6a1d_6cb5_2f2eae58c628["disconnect()"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|calls| 55fc1fa0_09b4_6a1d_6cb5_2f2eae58c628
  49028cb7_a127_0716_20ed_4fc1e1c7c988["close()"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|calls| 49028cb7_a127_0716_20ed_4fc1e1c7c988
  c5a95111_bf75_eef9_82e9_d3b52fb23759["flush()"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|calls| c5a95111_bf75_eef9_82e9_d3b52fb23759
  52f75d24_7c2b_f055_d7e7_b2cfcc304a7f["isStateSet()"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|calls| 52f75d24_7c2b_f055_d7e7_b2cfcc304a7f
  e7a7ecf5_bbaa_6525_0168_c2a3b76d209d["safeClose()"]
  22b36647_11f2_7260_1e39_2e07c2db7166 -->|calls| e7a7ecf5_bbaa_6525_0168_c2a3b76d209d
  style 22b36647_11f2_7260_1e39_2e07c2db7166 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/SslHandler.java lines 2106–2140

    private void closeOutboundAndChannel(
            final ChannelHandlerContext ctx, final ChannelPromise promise, boolean disconnect) throws Exception {
        setState(STATE_OUTBOUND_CLOSED);
        engine.closeOutbound();

        if (!ctx.channel().isActive()) {
            if (disconnect) {
                ctx.disconnect(promise);
            } else {
                ctx.close(promise);
            }
            return;
        }

        ChannelPromise closeNotifyPromise = ctx.newPromise();
        try {
            flush(ctx, closeNotifyPromise);
        } finally {
            if (!isStateSet(STATE_CLOSE_NOTIFY)) {
                setState(STATE_CLOSE_NOTIFY);
                // It's important that we do not pass the original ChannelPromise to safeClose(...) as when flush(....)
                // throws an Exception it will be propagated to the AbstractChannelHandlerContext which will try
                // to fail the promise because of this. This will then fail as it was already completed by
                // safeClose(...). We create a new ChannelPromise and try to notify the original ChannelPromise
                // once it is complete. If we fail to do so we just ignore it as in this case it was failed already
                // because of a propagated Exception.
                //
                // See https://github.com/netty/netty/issues/5931
                safeClose(ctx, closeNotifyPromise, PromiseNotifier.cascade(false, ctx.newPromise(), promise));
            } else {
                /// We already handling the close_notify so just attach the promise to the sslClosePromise.
                sslClosePromise.addListener(f -> promise.setSuccess());
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does closeOutboundAndChannel() do?
closeOutboundAndChannel() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java.
Where is closeOutboundAndChannel() defined?
closeOutboundAndChannel() is defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java at line 2106.
What does closeOutboundAndChannel() call?
closeOutboundAndChannel() calls 6 function(s): close, disconnect, flush, isStateSet, safeClose, setState.
What calls closeOutboundAndChannel()?
closeOutboundAndChannel() is called by 2 function(s): close, disconnect.

Analyze Your Own Codebase

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

Try Supermodel Free