Skip to content

Handle non-blocking TLS read retries explicitly in ssl_read_internal#3322

Closed
Copilot wants to merge 1 commit intocopilot/sub-pr-3301from
copilot/sub-pr-3321
Closed

Handle non-blocking TLS read retries explicitly in ssl_read_internal#3322
Copilot wants to merge 1 commit intocopilot/sub-pr-3301from
copilot/sub-pr-3321

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

ssl_read_internal.cpp treated any negative return from mbedtls_ssl_read() as the same error path. This PR narrows that behavior to correctly recognize non-blocking retry states (WANT_READ / WANT_WRITE) and preserve expected read flow.

  • Behavioral correction

    • Replaced broad ret < 0 handling with explicit checks for:
      • MBEDTLS_ERR_SSL_WANT_READ
      • MBEDTLS_ERR_SSL_WANT_WRITE
    • Aligns read-loop behavior with mbedTLS non-blocking semantics, avoiding misclassification of retryable conditions.
  • Impact scope

    • Single-file, targeted change in:
      • src/PAL/COM/sockets/ssl/MbedTLS/ssl_read_internal.cpp
    • No API surface or protocol contract changes.
int ret = mbedtls_ssl_read(ssl, (unsigned char *)(data), size);

// before
// if (ret < 0)

// after
if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE)
{
    // retry path
}

Copilot AI changed the title [WIP] Update ssl_read_internal for better flow Handle non-blocking TLS read retries explicitly in ssl_read_internal Apr 15, 2026
Copilot AI requested a review from Ellerbach April 15, 2026 12:30
@Ellerbach Ellerbach closed this Apr 15, 2026
@nfbot nfbot added the invalid label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants