summaryrefslogtreecommitdiffstats
path: root/tokio-util
AgeCommit message (Collapse)Author
2020-12-11util: add constructors to TokioContext (#3221)Alice Ryhl
2020-12-10net: Pass SocketAddr by value (#3125)Nylonicious
2020-12-09chore: prepare for Tokio 1.0 work (#3238)Carl Lerche
2020-12-03util: prepare v0.5.1 release (#3210)Eliza Weisman
### Added - io: `poll_read_buf` util fn (#2972). - io: `poll_write_buf` util fn with vectored write support (#3156). Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2020-12-03util: add writev-aware `poll_write_buf` (#3156)Eliza Weisman
## Motivation In Tokio 0.2, `AsyncRead` and `AsyncWrite` had `poll_write_buf` and `poll_read_buf` methods for reading and writing to implementers of `bytes` `Buf` and `BufMut` traits. In 0.3, these were removed, but `poll_read_buf` was added as a free function in `tokio-util`. However, there is currently no `poll_write_buf`. Now that `AsyncWrite` has regained support for vectored writes in #3149, there's a lot of potential benefit in having a `poll_write_buf` that uses vectored writes when supported and non-vectored writes when not supported, so that users don't have to reimplement this. ## Solution This PR adds a `poll_write_buf` function to `tokio_util::io`, analogous to the existing `poll_read_buf` function. This function writes from a `Buf` to an `AsyncWrite`, advancing the `Buf`'s internal cursor. In addition, when the `AsyncWrite` supports vectored writes (i.e. its `is_write_vectored` method returns `true`), it will use vectored IO. I copied the documentation for this functions from the docs from Tokio 0.2's `AsyncWrite::poll_write_buf` , with some minor modifications as appropriate. Finally, I fixed a minor issue in the existing docs for `poll_read_buf` and `read_buf`, and updated `tokio_util::codec` to use `poll_write_buf`. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2020-11-29util: add rt to tokio-util full feature (#3194)Alice Ryhl
2020-11-24codec: add read_buffer_mut to FramedRead (#3166)漂流
2020-11-23time: use intrusive lists for timer tracking (#3080)bdonlan
More-or-less a half-rewrite of the current time driver, supporting the use of intrusive futures for timer registration. Fixes: #3028, #3069
2020-11-20util: fix typo in udp/frame.rs (#3154)cssivision
2020-11-13chore: update pin-project-lite to 0.2.0 (#3139)Taiki Endo
2020-11-06util: resurrect UdpFramed (#3044)Evan Cameron
2020-11-03util: remove stream feature flag from DelayQueue (#3087)Akira Hayakawa
2020-11-02util: copy paste error in documentation for Compat (#3088)Naja Melan
2020-11-01util: add back public poll_read_buf() function (#3079)Dirkjan Ochtman
This was accidentally removed in #3064.
2020-10-30chore: prepare tokio-util v0.5.0 release (#3078)Carl Lerche
2020-10-29util: update to bytes 0.6 (#3071)Dirkjan Ochtman
Copies the implementation of poll_read_buf() from tokio::io::util::read_buf.
2020-10-29util: deduplicate implementations of poll_read_buf() (#3064)Dirkjan Ochtman
2020-10-27Revert "util: upgrade tokio-util to bytes 0.6 (#3052)" (#3060)Carl Lerche
This reverts commit fe2b997. We are avoiding adding poll_read_buf to tokio itself for now. The patch is reverted now in order to not block the v0.3.2 release (#3059).
2020-10-27util: upgrade tokio-util to bytes 0.6 (#3052)Dirkjan Ochtman
2020-10-20util: prevent read buffer from being swapped during a read_poll (#2993)John-John Tedro
2020-10-19util: add a poll_read_buf shim to tokio-util (#2972)John-John Tedro
2020-10-15chore: post release Cargo.toml fixes (#2963)Carl Lerche
2020-10-15chore: prepare for v0.3.0 release (#2960)Carl Lerche
2020-10-13rt: switch `enter` to an RAII guard (#2954)Carl Lerche
2020-10-12rt: simplify rt-* features (#2949)Taiki Endo
tokio: merge rt-core and rt-util as rt rename rt-threaded to rt-multi-thread tokio-util: rename rt-core to rt Closes #2942
2020-10-12rt: Remove `threaded_scheduler()` and `basic_scheduler()` (#2876)Lucio Franco
Co-authored-by: Alice Ryhl <alice@ryhl.io> Co-authored-by: Carl Lerche <me@carllerche.com>
2020-10-12time: move error types into `time::error` (#2938)Juan Alvarez
2020-10-12io: Rename `ReadBuf` methods (#2945)Lucio Franco
This changes `ReadBuf::add_filled` to `ReadBuf::advance` and `ReadBuf::append` to `ReadBuf::put_slice`. This is just a mechanical change. Closes #2769
2020-10-08time: rename `Delay` future to `Sleep` (#2932)Juan Alvarez
2020-10-08chore: Fix clippy lints (#2931)bdonlan
Closes: #2929 Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
2020-10-08io: remove Poll from the AsyncSeek::start_seek return value (#2885)Zahari Dichev
2020-10-07util: fix a typo in sync/cancellation_token.rs (#2922)Taiki Endo
2020-10-06time: clean time driver (#2905)greenwoodcm
* remove unnecessary wheel::Poll the timer wheel uses the `wheel::Poll` struct as input when advancing the timer to the next time step. the `Poll` struct contains an instant representing the time step to advance to and also contains an optional and mutable reference to an `Expiration` struct. from what I can tell, the latter field is only used in the context of polling the wheel and does not need to be exposed outside of that method. without the expiration field the `Poll` struct is nothing more than a wrapper around the instant being polled. this change removes the `Poll` struct and updates integration points accordingly. * remove Stack trait in favor of concrete Stack implementation * remove timer Registration struct
2020-10-05time: move DelayQueue to tokio-util (#2897)bdonlan
This change is intended to do the minimum to unblock 0.3; as such, for now, we duplicate the internal `time::wheel` structures in tokio-util, rather than trying to refactor things at this stage. Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
2020-10-01time: introduce `sleep` and `sleep_until` functions (#2826)Juan Alvarez
2020-09-24io: remove poll_{read,write}_buf from traits (#2882)Carl Lerche
These functions have object safety issues. It also has been decided to avoid vectored operations on the I/O traits. A later PR will bring back vectored operations on specific types that support them. Refs: #2879, #2716
2020-09-23io: use intrusive wait list for I/O driver (#2828)Sean McArthur
This refactors I/O registration in a few ways: - Cleans up the cached readiness in `PollEvented`. This cache used to be helpful when readiness was a linked list of `*mut Node`s in `Registration`. Previous refactors have turned `Registration` into just an `AtomicUsize` holding the current readiness, so the cache is just extra work and complexity. Gone. - Polling the `Registration` for readiness now gives a `ReadyEvent`, which includes the driver tick. This event must be passed back into `clear_readiness`, so that the readiness is only cleared from `Registration` if the tick hasn't changed. Previously, it was possible to clear the readiness even though another thread had *just* polled the driver and found the socket ready again. - Registration now also contains an `async fn readiness`, which stores wakers in an instrusive linked list. This allows an unbounded number of tasks to register for readiness (previously, only 1 per direction (read and write)). By using the intrusive linked list, there is no concern of leaking the storage of the wakers, since they are stored inside the `async fn` and released when the future is dropped. - Registration retains a `poll_readiness(Direction)` method, to support `AsyncRead` and `AsyncWrite`. They aren't able to use `async fn`s, and so there are 2 reserved slots for those methods. - IO types where it makes sense to have multiple tasks waiting on them now take advantage of this new `async fn readiness`, such as `UdpSocket` and `UnixDatagram`. Additionally, this makes the `io-driver` "feature" internal-only (no longer documented, not part of public API), and adds a second internal-only feature, `io-readiness`, to group together linked list part of registration that is only used by some of the IO types. After a bit of discussion, changing stream-based transports (like `TcpStream`) to have `async fn read(&self)` is punted, since that is likely too easy of a footgun to activate. Refs: #2779, #2728
2020-09-19util: remove Slice wrapper (#2847)Taiki Endo
2020-09-13doc: fix some links (#2834)Alice Ryhl
2020-09-08util: implement Either type (#2821)Igor Aleksanov
2020-09-08io: move StreamReader and ReaderStream into tokio_util (#2788)Alice Ryhl
Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru> Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-08-27rt: Refactor `Runtime::block_on` to take `&self` (#2782)Lucio Franco
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-08-27util: Add `TokioContext` future (#2791)Blas Rodriguez Irizar
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
2020-08-23sync: move CancellationToken to tokio-util (#2721)Carl Lerche
* sync: move CancellationToken to tokio-util The `CancellationToken` utility is only available with the `tokio_unstable` flag. This was done as the API is not final, but it adds friction for users. This patch moves `CancellationToken` to tokio-util where it is generally available. The tokio-util crate does not have any constraints on breaking change releases. * fix clippy * clippy again
2020-08-13io: change AsyncRead to use a ReadBuf (#2758)Sean McArthur
Works towards #2716. Changes the argument to `AsyncRead::poll_read` to take a `ReadBuf` struct that safely manages writes to uninitialized memory.
2020-08-07chore: prepare for v0.3 breaking changes (#2747)Carl Lerche
Bug fixes will be applied to the v0.2.x branch.
2020-07-23udp: Fix `UdpFramed` with regards to `Decode` (#1445)John Doneth
2020-07-20chore: fix new manual_non_exhaustive clippy lint (#2669)Alice Ryhl
Our minimum supported Rust version does not allow switching to `#[non_exhaustive]`.
2020-05-31docs: use intra-links in the docs (#2575)xliiv
2020-05-20codec: add Framed::read_buffer_mut (#2546)Ondřej Hruška
Adds a method to retrieve a mutable reference to the Framed stream's read buffer. This makes it possible to e.g. externally clear the buffer to prevent the codec from parsing stale data.