Skip to content

mbedtls: handle WSAEWOULDBLOCK in net_send on Windows#3619

Open
saghul wants to merge 1 commit into
warmcat:mainfrom
saghul:fix-mbedtls-win-send-wouldblock
Open

mbedtls: handle WSAEWOULDBLOCK in net_send on Windows#3619
saghul wants to merge 1 commit into
warmcat:mainfrom
saghul:fix-mbedtls-win-send-wouldblock

Conversation

@saghul

@saghul saghul commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

On Windows LWS_ERRNO is WSAGetLastError(), so a full socket send buffer
reports WSAEWOULDBLOCK (10035), not the CRT EWOULDBLOCK. lws_plat_mbedtls_net_send
only matched EAGAIN/EWOULDBLOCK, so a backed-up send (e.g. a large HTTP/2 request
body upload, where the loopback/peer send buffer fills) was misreported as a fatal
MBEDTLS_ERR_NET_SEND_FAILED rather than a retryable WANT_WRITE, tearing down the
connection. The sibling lws_plat_mbedtls_net_recv already checks WSAEWOULDBLOCK;
mirror it in net_send.

On Windows LWS_ERRNO is WSAGetLastError(), so a full socket send buffer
reports WSAEWOULDBLOCK (10035), not the CRT EWOULDBLOCK. lws_plat_mbedtls_net_send
only matched EAGAIN/EWOULDBLOCK, so a backed-up send (e.g. a large HTTP/2 request
body upload, where the loopback/peer send buffer fills) was misreported as a fatal
MBEDTLS_ERR_NET_SEND_FAILED rather than a retryable WANT_WRITE, tearing down the
connection. The sibling lws_plat_mbedtls_net_recv already checks WSAEWOULDBLOCK;
mirror it in net_send.
@sonarqubecloud

Copy link
Copy Markdown

@lws-team lws-team force-pushed the main branch 5 times, most recently from 6eecf5a to b4b5aed Compare June 20, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant