Home / Function/ applyHandshakeTimeout() — netty Function Reference

applyHandshakeTimeout() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  8fbbb8f9_4fbe_de99_c718_f954c3700023["applyHandshakeTimeout()"]
  7859e8c2_d3fe_97c8_edc5_e54ff6dd5668["WebSocketServerProtocolHandshakeHandler"]
  8fbbb8f9_4fbe_de99_c718_f954c3700023 -->|defined in| 7859e8c2_d3fe_97c8_edc5_e54ff6dd5668
  da9f8d7e_bece_8a5d_bade_9cfafa7bf590["channelRead()"]
  da9f8d7e_bece_8a5d_bade_9cfafa7bf590 -->|calls| 8fbbb8f9_4fbe_de99_c718_f954c3700023
  style 8fbbb8f9_4fbe_de99_c718_f954c3700023 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolHandshakeHandler.java lines 140–161

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

        final Future<?> timeoutFuture = ctx.executor().schedule(new Runnable() {
            @Override
            public void run() {
                if (!localHandshakePromise.isDone() &&
                    localHandshakePromise.tryFailure(new WebSocketServerHandshakeException("handshake timed out"))) {
                    ctx.flush()
                       .fireUserEventTriggered(ServerHandshakeStateEvent.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/WebSocketServerProtocolHandshakeHandler.java.
Where is applyHandshakeTimeout() defined?
applyHandshakeTimeout() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolHandshakeHandler.java at line 140.
What calls applyHandshakeTimeout()?
applyHandshakeTimeout() is called by 1 function(s): channelRead.

Analyze Your Own Codebase

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

Try Supermodel Free