Home / Function/ applyHandshakeTimeout() — netty Function Reference

applyHandshakeTimeout() — netty Function Reference

Architecture documentation for the applyHandshakeTimeout() function in WebSocketClientProtocolHandshakeHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7dce26db_1d92_f1c4_0087_d998f7086afe["applyHandshakeTimeout()"]
  825155a9_3784_59cc_4b68_f6750284e255["WebSocketClientProtocolHandshakeHandler"]
  7dce26db_1d92_f1c4_0087_d998f7086afe -->|defined in| 825155a9_3784_59cc_4b68_f6750284e255
  24cd2522_914a_7d42_2e66_20f575aed17c["channelActive()"]
  24cd2522_914a_7d42_2e66_20f575aed17c -->|calls| 7dce26db_1d92_f1c4_0087_d998f7086afe
  style 7dce26db_1d92_f1c4_0087_d998f7086afe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientProtocolHandshakeHandler.java lines 101–124

    private void applyHandshakeTimeout() {
        final ChannelPromise localHandshakePromise = handshakePromise;
        if (handshakeTimeoutMillis <= 0 || localHandshakePromise.isDone()) {
            return;
        }

        final Future<?> timeoutFuture = ctx.executor().schedule(new Runnable() {
            @Override
            public void run() {
                if (localHandshakePromise.isDone()) {
                    return;
                }

                if (localHandshakePromise.tryFailure(new WebSocketClientHandshakeException("handshake timed out"))) {
                    ctx.flush()
                       .fireUserEventTriggered(ClientHandshakeStateEvent.HANDSHAKE_TIMEOUT)
                       .close();
                }
            }
        }, handshakeTimeoutMillis, TimeUnit.MILLISECONDS);

        // Cancel the handshake timeout when handshake is finished.
        localHandshakePromise.addListener(f -> timeoutFuture.cancel(false));
    }

Subdomains

Called By

Frequently Asked Questions

What does applyHandshakeTimeout() do?
applyHandshakeTimeout() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientProtocolHandshakeHandler.java.
Where is applyHandshakeTimeout() defined?
applyHandshakeTimeout() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientProtocolHandshakeHandler.java at line 101.
What calls applyHandshakeTimeout()?
applyHandshakeTimeout() is called by 1 function(s): channelActive.

Analyze Your Own Codebase

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

Try Supermodel Free