Home / Function/ doClose() — netty Function Reference

doClose() — netty Function Reference

Architecture documentation for the doClose() function in QuicheQuicChannel.java from the netty codebase.

Function java Buffer Allocators calls 6 called by 1

Entity Profile

Dependency Diagram

graph TD
  d09a66fb_105e_24b9_4756_bb03a3f780fa["doClose()"]
  3c534d05_bb5b_c991_5e03_7ec94e739cf7["QuicheQuicChannel"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|defined in| 3c534d05_bb5b_c991_5e03_7ec94e739cf7
  1cc43a70_3f25_8ae7_cfa8_e88a54f3aac2["doDisconnect()"]
  1cc43a70_3f25_8ae7_cfa8_e88a54f3aac2 -->|calls| d09a66fb_105e_24b9_4756_bb03a3f780fa
  71f869b5_f8a3_eeab_e61b_37fed86049e3["failPendingConnectPromise()"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|calls| 71f869b5_f8a3_eeab_e61b_37fed86049e3
  646632d7_c969_ccd0_3a34_06087c4828ed["collectStats0()"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|calls| 646632d7_c969_ccd0_3a34_06087c4828ed
  d9ba5745_6917_1f04_889e_f4c2676bfdbb["closeStreams()"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|calls| d9ba5745_6917_1f04_889e_f4c2676bfdbb
  d21171a6_3135_05f4_7ac2_3fd3258ddab8["forceFlushParent()"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|calls| d21171a6_3135_05f4_7ac2_3fd3258ddab8
  d7575fb7_9073_0e3e_6ab3_7d2612f1eb16["flushParent()"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|calls| d7575fb7_9073_0e3e_6ab3_7d2612f1eb16
  b747d616_c157_971c_d76e_49712809b326["cancel()"]
  d09a66fb_105e_24b9_4756_bb03a3f780fa -->|calls| b747d616_c157_971c_d76e_49712809b326
  style d09a66fb_105e_24b9_4756_bb03a3f780fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java lines 567–649

    @Override
    protected void doClose() throws Exception {
        if (state == ChannelState.CLOSED) {
            return;
        }
        state = ChannelState.CLOSED;

        QuicheQuicConnection conn = this.connection;
        if (conn == null || conn.isFreed()) {
            if (closeData != null) {
                closeData.reason.release();
                closeData = null;
            }
            failPendingConnectPromise();
            return;
        }

        // Call connectionSend() so we ensure we send all that is queued before we close the channel
        SendResult sendResult = connectionSend(conn);

        final boolean app;
        final int err;
        final ByteBuf reason;
        if (closeData == null) {
            app = false;
            err = 0;
            reason = Unpooled.EMPTY_BUFFER;
        } else {
            app = closeData.applicationClose;
            err = closeData.err;
            reason = closeData.reason;
            closeData = null;
        }

        failPendingConnectPromise();
        try {
            int res = Quiche.quiche_conn_close(conn.address(), app, err,
                    Quiche.readerMemoryAddress(reason), reason.readableBytes());
            if (res < 0 && res != Quiche.QUICHE_ERR_DONE) {
                throw Quiche.convertToException(res);
            }
            // As we called quiche_conn_close(...) we need to ensure we will call quiche_conn_send(...) either
            // now or we will do so once we see the channelReadComplete event.
            //
            // See https://docs.rs/quiche/0.6.0/quiche/struct.Connection.html#method.close
            if (connectionSend(conn) == SendResult.SOME) {
                sendResult = SendResult.SOME;
            }
        } finally {

            // making sure that connection statistics is available
            // even after channel is closed
            statsAtClose = collectStats0(conn, eventLoop().newPromise());
            try {
                timedOut = Quiche.quiche_conn_is_timed_out(conn.address());

                closeStreams();
                if (finBuffer != null) {
                    finBuffer.release();
                    finBuffer = null;
                }
                if (outErrorCodeBuffer != null) {
                    outErrorCodeBuffer.release();
                    outErrorCodeBuffer = null;
                }
            } finally {
                if (sendResult == SendResult.SOME) {
                    // As this is the close let us flush it asap.
                    forceFlushParent();
                } else {
                    flushParent();
                }
                conn.free();
                if (freeTask != null) {
                    freeTask.accept(this);
                }
                timeoutHandler.cancel();

                local = null;
                remote = null;
            }

Domain

Subdomains

Called By

Frequently Asked Questions

What does doClose() do?
doClose() is a function in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java.
Where is doClose() defined?
doClose() is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java at line 567.
What does doClose() call?
doClose() calls 6 function(s): cancel, closeStreams, collectStats0, failPendingConnectPromise, flushParent, forceFlushParent.
What calls doClose()?
doClose() is called by 1 function(s): doDisconnect.

Analyze Your Own Codebase

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

Try Supermodel Free