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 purpose of this PR is to simplify the network API on the road to 1.0.0 #395.
This is mainly to gather feedback on the API shape, especially around
io_statusand error handling.udp_peer,tls_client, and others arenot implemented in this PR yet.
Why:
poll().write_allandread_exacthandle timeouts internally.io_status)poll()+recv/send), which works for epoll/kqueue but does not work with completion-based backends like IOCP (Windows) and io_uringKey changes:
Read/Write API: encapsulates
poll()logicread_some/write_some: Asynchronously waits for the socket to be ready and performs a single read/write operationread_exact/write_all: High-level helpers that loop until the entire buffer is processed or an error/timeout occursUnified
io_statuskind(e.g.ok,timeout,closed) and thenative_code(errno, WSAGetLastError for Windows in the future).message()is_ok(), is_timeout()checks instead ofstatus == coro::net::recv_status::some_statusThe sync
accept()renamed inaccept_now(). The newaccept()is asynchronous.Using
std::span<const std::byte>andstd::span<std::byte>. Easy integration withstd::as_bytesandstd::as_writable_bytesExamples:
Reading
Writing
New client