Skip to content

Document how shutdown is reported by the receive functions - #23

Open
kroxiksut wants to merge 1 commit into
tun2proxy:masterfrom
kroxiksut:doc-recv-shutdown
Open

kroxiksut wants to merge 1 commit into
tun2proxy:masterfrom
kroxiksut:doc-recv-shutdown

Conversation

@kroxiksut

Copy link
Copy Markdown

The docs of Session::recv and Session::receive_blocking say that after Session::shutdown they return Err(()), which no longer matches their signatures: receive_blocking returns Error::ShuttingDown, and recv returns an std::io::Error that wraps it. Without reading the source, a caller cannot tell a shutdown from a real failure.

This updates the docs of receive_blocking, recv, wait_read, shutdown and AsyncSession::recv, and adds a doctest to recv that shows how to recognise the shutdown error and checks that it works.

Docs only, no code changes. cargo test (the new doctest included), cargo doc --no-deps --all-features without warnings, clippy with and without --all-features, and cargo fmt -- --check pass.

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