Home / Function/ SSLEngineResult() — netty Function Reference

SSLEngineResult() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  69569884_b53f_4a6d_2905_0f9db5cafbed["SSLEngineResult()"]
  d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1["SslHandler"]
  69569884_b53f_4a6d_2905_0f9db5cafbed -->|defined in| d8b07a7c_44f8_c4e9_efe8_49bfae7d4af1
  ca3c58ac_45a7_24e9_d74b_140cea69627e["wrap()"]
  69569884_b53f_4a6d_2905_0f9db5cafbed -->|calls| ca3c58ac_45a7_24e9_d74b_140cea69627e
  style 69569884_b53f_4a6d_2905_0f9db5cafbed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/SslHandler.java lines 1083–1121

    private SSLEngineResult wrapMultiple(ByteBufAllocator alloc, SSLEngine engine, ByteBuf in, ByteBuf out)
        throws SSLException {
        SSLEngineResult result = null;

        do {
            int nextSliceSize = Math.min(MAX_PLAINTEXT_LENGTH, in.readableBytes());
            // This call over-estimates, because we are slicing and not every nioBuffer will be part of
            // every slice. We could improve the estimate by having an nioBufferCount(offset, length).
            int nextOutSize = engineType.calculateRequiredOutBufSpace(this, nextSliceSize, in.nioBufferCount());

            if (!out.isWritable(nextOutSize)) {
                if (result != null) {
                    // We underestimated the space needed to encrypt the entire in buf. Break out, and
                    // upstream will re-enqueue the buffer for later.
                    break;
                }
                // This shouldn't happen, as the out buf was properly sized for at least packetLength
                // prior to calling wrap.
                out.ensureWritable(nextOutSize);
            }

            ByteBuf wrapBuf = in.readSlice(nextSliceSize);
            result = wrap(alloc, engine, wrapBuf, out);

            if (result.getStatus() == Status.CLOSED) {
                // If the engine gets closed, we can exit out early. Otherwise, we'll do a full handling of
                // possible results once finished.
                break;
            }

            if (wrapBuf.isReadable()) {
                // There may be some left-over, in which case we can just pick it up next loop, so reset the original
                // reader index so its included again in the next slice.
                in.readerIndex(in.readerIndex() - wrapBuf.readableBytes());
            }
        } while (in.readableBytes() > 0);

        return result;
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does SSLEngineResult() do?
SSLEngineResult() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java.
Where is SSLEngineResult() defined?
SSLEngineResult() is defined in handler/src/main/java/io/netty/handler/ssl/SslHandler.java at line 1083.
What does SSLEngineResult() call?
SSLEngineResult() calls 1 function(s): wrap.

Analyze Your Own Codebase

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

Try Supermodel Free