Skip to content

Add PackagePtr::Start for FastTx package send - #515

Closed
NikolayChirkov wants to merge 2 commits into
mainfrom
cursor/package-ptr-start-83a6
Closed

Add PackagePtr::Start for FastTx package send#515
NikolayChirkov wants to merge 2 commits into
mainfrom
cursor/package-ptr-start-83a6

Conversation

@NikolayChirkov

@NikolayChirkov NikolayChirkov commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements the FastTx step after EncodePacket: PackagePtrStart().

  • Ports the aether/prepared_packet/ foundation from prepared-packet-v0 / PR Add prepared send_message packet API #513 (PreparedSendMessageBlock, EncodePacket, PrepareSendMessage, export APIs).
  • Adds Package / PackagePtr owning encoded bytes + destination endpoint.
  • Package::Start(SendFunc) sends through a caller-provided raw send function (external code owns the UDP socket), with would-block retry via the task scheduler and WriteAction status events.
  • Adds tests/test-prepared-packet covering success, retry, fail, and stop.

API sketch

auto block = prepared_packet::PrepareSendMessage(stream, nonce_count);
auto package = prepared_packet::MakePackage(ae_context, *block, payload);
package->Start([](auto const& endpoint, Span<uint8_t const> data)
                   -> std::optional<std::size_t> {
  // sendto(...) on externally owned socket
  return bytes_sent; // 0 = would-block, nullopt = fail
});

Test plan

  • Configure + build aether and test-prepared-packet
  • ctest . --progress -j -E "((sodium)|(hydro)|(bcrypt)).*" --output-on-failure — 23/23 passed
  • tests/run/test-prepared-packet — 4/4 passed
Open in Web Open in Cursor 

cursoragent and others added 2 commits July 20, 2026 23:31
Bring prepared_packet encode/export foundation onto main and add Package /
PackagePtr so EncodePacket output can be owned and started through an
externally owned UDP send function, with would-block retry via the task
scheduler.

Co-authored-by: Nikolay Chirkov <NikolayChirkov@users.noreply.github.com>
Co-authored-by: Nikolay Chirkov <NikolayChirkov@users.noreply.github.com>
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.

2 participants