Skip to content

fix(endpointbuf): wait_for counts bytes already in the get area - #71

Merged
ruoka merged 4 commits into
masterfrom
fix/wait-for-buffered
Oct 25, 2026
Merged

ruoka merged 4 commits into
masterfrom
fix/wait-for-buffered

Conversation

@ruoka

@ruoka ruoka commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

endpointbuf::wait_for polled only the socket. When one recv brought two messages, the second sat in the get area and wait_for reported nothing readable until the peer sent more bytes: a FIX session (fixer) read the second of two back-to-back execution reports only after the peer's next heartbeat.

wait_for now returns true at once while unread bytes are buffered. The WebSocket close drain's comment no longer says wait_for polls only the socket.

It also pins cryptic v3.0.2. Since v3.0.0, one of the cryptic tests that net builds with its own used OpenSSL, so the Linux test runner failed to link and master's CI has been red since v3.5.0. v3.0.2 keeps OpenSSL inside cryptic's own build. Nothing net builds uses OpenSSL, so CI and the dev container no longer install libssl-dev.

The fix was written on the previous master, and fixer's history pins it there, so v3.5.0 comes in by a merge (it merged cleanly) rather than a rebase. Please merge this with a merge commit, not squash or rebase, so the commits fixer pins stay on master.

Testing

  • New scenario "wait_for sees a message already buffered" (net/net-endpoint_stream.test.c++): the client sends first\nsecond\n in one write; after reading first, wait_for(200ms) must report second without the client sending more.
  • ./tools/CB.sh debug test --jsonl=failures: 993/993 passed on this tree.
  • CI on this branch: build-and-test (debug and release), static-analysis and submodule-check pass.

Note

Medium Risk
Changes stream readiness semantics for any code using endpointbuf::wait_for (including WebSocket close draining); behavior is more correct but callers that relied on the old socket-only poll may see earlier readiness.

Overview
endpointbuf::wait_for no longer polls only the socket: it returns true immediately when unread bytes remain in the streambuf get area (gptr() < egptr()), so a second message delivered in the same recv is visible without waiting for more peer traffic (regression tied to back-to-back FIX-style reads).

A new BDD scenario in net-endpoint_stream.test.c++ locks this in (first\nsecond\n in one write; wait_for after first must see second). The WebSocket close-drain comment is updated to match buffered-byte behavior.

Docs bump the deps/cryptic pin to v3.0.2 in README and docs/release-policy.md. libssl-dev is dropped from the devcontainer Dockerfile, the setup-llvm default package list, and the CI static-analysis LLVM install step.

Reviewed by Cursor Bugbot for commit 2ead0f4. Bugbot is set up for automated code reviews on this repo. Configure here.

ruoka and others added 4 commits October 25, 2026 12:06
wait_for polled only the socket. When one recv brought two messages, the
second sat in the get area and wait_for reported nothing readable until the
peer sent more bytes: a FIX session read the second of two back-to-back
execution reports only after the peer's next heartbeat. wait_for now returns
true at once while unread bytes are buffered. The WebSocket close drain's
comment no longer says wait_for polls only the socket.

Co-authored-by: Cursor <cursoragent@cursor.com>
fixer's history pins the fix as first written, on the earlier master, so
the fix comes onto v3.5.0 by a merge rather than a rebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
The tests of cryptic's that net builds with its own used OpenSSL since
v3.0.0, so the Linux test runner failed to link. v3.0.2 keeps OpenSSL
inside cryptic's own build.

Co-authored-by: Cursor <cursoragent@cursor.com>
Nothing net builds uses OpenSSL.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ruoka
ruoka merged commit 0d90ed1 into master Oct 25, 2026
5 checks passed
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