Repository navigation
io: close the session on hang-up results - #1360
Open
ejohnstown wants to merge 2 commits into
Open
ejohnstown wants to merge 2 commits into
ejohnstown wants to merge 2 commits into
Conversation
GetInputData() now fails with WS_SOCKET_ERROR_E and marks the session closed when the recv callback returns 0, as GetInputLine() already does. A custom callback reporting an orderly shutdown no longer spins DoReceive() forever. - tests: DoReceive with a callback that always returns 0 Issue: F-14397
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new test can fail under contention builds due to injected would-block results and under lwIP builds because it may intercept the wrong send backend.
2 open issues
What changed in this PR
This PR updates wolfSSH’s I/O handling to recognize peer hang-ups, preventing repeated receive attempts and marking affected sessions closed.
Changes:
- Treat a zero receive-callback result in
GetInputData()as a fatal socket error. - Map send-side
ECONNABORTEDto a closed connection, matching receive-side handling. - Add regression tests for both cases and their session-state effects.
| File | Description |
|---|---|
tests/unit.c |
Adds zero-receive and aborted-send regression tests. |
src/io.c |
Maps send-side ECONNABORTED to connection closure. |
src/internal.c |
Stops packet reception and marks the session closed on zero-byte reads. |
Review effort: Balanced
ejohnstown
force-pushed
the
io-callback-contract
branch
from
November 2, 2026 20:09
e1bd68d to
716bff8
Compare
wsEmbedSend() returns WS_CBIO_ERR_CONN_CLOSE for SOCKET_ECONNABORTED, matching wsEmbedRecv(), so an aborted connection during a send sets isClosed instead of being reported as a general error. - unit: a send failing with ECONNABORTED closes the session Issue: F-13903
ejohnstown
force-pushed
the
io-callback-contract
branch
from
November 2, 2026 20:51
716bff8 to
36341f7
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1360
Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 2 of 3 in-scope changed file(s) opened by the reviewer; not opened: tests/unit.c
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The I/O layer marks the session closed for two callback results it
used to treat as something else.
returns 0, instead of spinning DoReceive()
wsEmbedRecv()
Issue: F-14397, F-13903