Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update && \

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y --no-install-recommends \
git file jq libssl-dev \
git file jq \
clang-21 libc++-21-dev libc++abi-21-dev lld-21 clang-tools-21 lldb-21 && \
rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-llvm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
packages:
description: "Space-separated apt packages to install (default includes libc++, clang, lld, lldb, jq)"
required: false
default: "libc++-21-dev libc++abi-21-dev clang-21 lld-21 lldb-21 jq libssl-dev clang-tools-21"
default: "libc++-21-dev libc++abi-21-dev clang-21 lld-21 lldb-21 jq clang-tools-21"

runs:
using: "composite"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
- name: Setup LLVM + analysis tools
uses: ./.github/actions/setup-llvm
with:
packages: "libc++-21-dev libc++abi-21-dev clang-21 lld-21 lldb-21 jq clang-tools-21 clang-tidy-21 cppcheck libssl-dev"
packages: "libc++-21-dev libc++abi-21-dev clang-21 lld-21 lldb-21 jq clang-tools-21 clang-tidy-21 cppcheck"

- name: Run clang-tidy (non-blocking)
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This subproject is designed to work both:
- **Standalone** (as its own repo, with `deps/tester` and `deps/cryptic` available), and
- **As a dependency inside YarDB** (reusing YarDB’s `deps/tester` and `deps/cryptic`).

The WebSocket handshake hashes with [cryptic](https://github.com/ruoka/cryptic) [`v3.0.0`](https://github.com/ruoka/cryptic/releases/tag/v3.0.0), pinned at `deps/cryptic`. That module is not re-exported by `import net`.
The WebSocket handshake hashes with [cryptic](https://github.com/ruoka/cryptic) [`v3.0.2`](https://github.com/ruoka/cryptic/releases/tag/v3.0.2), pinned at `deps/cryptic`. That module is not re-exported by `import net`.

## Versioning & Releases

Expand Down
2 changes: 1 addition & 1 deletion deps/cryptic
2 changes: 1 addition & 1 deletion docs/release-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ modules-era cut. Prior tags `v1.0` / `v2.0` / `v2.1` are historical.
Pin `v3.5.0` (or a later tag / deliberate commit). Nested `deps/tester` must match the
parent tree’s tester pin — see
[YarDB versioning](https://github.com/ruoka/YarDB/blob/master/docs/versioning.md).
`deps/cryptic` is pinned to cryptic [`v3.0.0`](https://github.com/ruoka/cryptic/releases/tag/v3.0.0)
`deps/cryptic` is pinned to cryptic [`v3.0.2`](https://github.com/ruoka/cryptic/releases/tag/v3.0.2)
for the WebSocket handshake. `import net` does not re-export it.

## What is public
Expand Down
4 changes: 3 additions & 1 deletion net/net-endpoint_buf.c++m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ public:
explicit endpointbuf_base(socket&& s) noexcept : m_socket{std::move(s)} {}
~endpointbuf_base() override = default;

// Unread bytes in the get area count: the socket shows only what recv has
// not taken yet.
bool wait_for(const std::chrono::milliseconds& timeout) const noexcept {
return m_socket.wait_for(timeout);
return gptr() < egptr() or m_socket.wait_for(timeout);
}

// Idle timeout for the next blocking recv. Zero (the default) blocks in
Expand Down
23 changes: 23 additions & 0 deletions net/net-endpoint_stream.test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,29 @@ tester::bdd::scenario("Bulk Data Transfer, [net]") = [] {
check_eq(sent_data, received_data);
};

// Regression: wait_for polled only the socket, so a message that arrived in the
// same recv as the one before it sat in the get area until the peer sent more
// bytes (a FIX session read the second of two back-to-back reports one
// heartbeat late).
tester::bdd::scenario("wait_for sees a message already buffered, [net]") = [] {
using namespace std::chrono_literals;
using namespace std::string_literals;

acceptor acc{"127.0.0.1", "0"};
auto client = connect("127.0.0.1", std::to_string(acc.bound_port()));
auto [stream, peer_host, peer_port] = acc.accept();
client << "first\nsecond\n" << net::flush;

auto line = ""s;
require_true(stream.wait_for(2s));
require_true(static_cast<bool>(std::getline(stream, line)));
check_eq(line, "first"s);
// The client sends nothing more: "second" came with "first".
check_true(stream.wait_for(200ms));
require_true(static_cast<bool>(std::getline(stream, line)));
check_eq(line, "second"s);
};

// Regression: after the TCP short-recv assemble fix, xsgetn looped recv for
// every socket type when count >= N. udp_buffer_size == N, so the natural
// max-datagram read waited forever for more bytes after the first message.
Expand Down
2 changes: 1 addition & 1 deletion net/net-websocket.c++m
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public:
break;
auto incoming = frame{};
const auto status = read_frame(m_stream, incoming, [&] {
// Prefer already-buffered bytes; wait_for only polls the socket.
// Bytes already buffered are read even once the deadline has passed.
if(m_stream.rdbuf() != nullptr and m_stream.rdbuf()->in_avail() > 0)
return true;
const auto remaining = std::chrono::duration_cast<std::chrono::milliseconds>(
Expand Down
Loading