Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: add UdpSocket::peek_sender() #5520

Merged
merged 3 commits into from Mar 17, 2023
Merged

Conversation

abonander
Copy link
Contributor

@abonander abonander commented Mar 1, 2023

closes #5491

Update: amended to add try_peek_from() as discussed on Discord.

The prerequesite addition to socket2 has landed on their v0.4.x branch but, as of writing, has not been released yet. This will remain a draft until that is released, but the API and documentation is ready for review.

Running Clippy as instructed by CONTRIBUTING.md gives the following error:

> cargo +1.49.0 clippy --all --tests --all-features
warning: /home/abonander/rust/tokio/tokio-test/Cargo.toml: unused manifest key: package.rust-version
warning: /home/abonander/rust/tokio/tokio-macros/Cargo.toml: unused manifest key: package.rust-version
warning: /home/abonander/rust/tokio/tokio/Cargo.toml: unused manifest key: package.rust-version
warning: /home/abonander/rust/tokio/tokio-util/Cargo.toml: unused manifest key: package.rust-version
warning: /home/abonander/rust/tokio/tokio-stream/Cargo.toml: unused manifest key: package.rust-version
    Updating crates.io index
error: failed to select a version for the requirement `predicates = "=2.1.5"`
candidate versions found which didn't match: 2.1.1, 2.1.0, 2.0.3, ...
location searched: crates.io index
required by package `mockall v0.11.3`
    ... which is depended on by `tokio v1.25.0 (/home/abonander/rust/tokio/tokio)`

This is baffling because predicates 2.1.5 definitely exists: https://crates.io/crates/predicates/2.1.5

Motivation

Discussed in #5491.

Solution

Discussed in #5491.

@Thomasdezeeuw
Copy link
Contributor

New release of socket2: rust-lang/socket2#406.

@abonander abonander force-pushed the peek-sender branch 2 times, most recently from 90c3b07 to bf586ac Compare March 4, 2023 00:12
@abonander abonander marked this pull request as ready for review March 4, 2023 00:12
tokio/src/net/udp.rs Outdated Show resolved Hide resolved
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-net Module: tokio/net labels Mar 4, 2023
@abonander abonander force-pushed the peek-sender branch 2 times, most recently from 287b0ea to 11d3655 Compare March 7, 2023 02:17
@abonander abonander force-pushed the peek-sender branch 2 times, most recently from 2d29179 to fc05e00 Compare March 8, 2023 22:25
@Thomasdezeeuw Thomasdezeeuw requested a review from a team March 10, 2023 09:09
@Thomasdezeeuw
Copy link
Contributor

I don't really review for Tokio, so I've asked for someone else to review.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than this comment, this looks good to me.

tokio/src/net/udp.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn merged commit d459a93 into tokio-rs:master Mar 17, 2023
52 checks passed
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Mar 29, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | dependencies | minor | `1.26.0` -> `1.27.0` |
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | dev-dependencies | minor | `1.26.0` -> `1.27.0` |

---

### Release Notes

<details>
<summary>tokio-rs/tokio</summary>

### [`v1.27.0`](https://github.com/tokio-rs/tokio/releases/tag/tokio-1.27.0): Tokio v1.27.0

[Compare Source](tokio-rs/tokio@tokio-1.26.0...tokio-1.27.0)

##### 1.27.0 (March 27th, 2023)

This release bumps the MSRV of Tokio to 1.56. ([#&#8203;5559])

##### Added

-   io: add `async_io` helper method to sockets ([#&#8203;5512])
-   io: add implementations of `AsFd`/`AsHandle`/`AsSocket` ([#&#8203;5514], [#&#8203;5540])
-   net: add `UdpSocket::peek_sender()` ([#&#8203;5520])
-   sync: add `RwLockWriteGuard::{downgrade_map, try_downgrade_map}` ([#&#8203;5527])
-   task: add `JoinHandle::abort_handle` ([#&#8203;5543])

##### Changed

-   io: use `memchr` from `libc` ([#&#8203;5558])
-   macros: accept path as crate rename in `#[tokio::main]` ([#&#8203;5557])
-   macros: update to syn 2.0.0 ([#&#8203;5572])
-   time: don't register for a wakeup when `Interval` returns `Ready` ([#&#8203;5553])

##### Fixed

-   fs: fuse std iterator in `ReadDir` ([#&#8203;5555])
-   tracing: fix `spawn_blocking` location fields ([#&#8203;5573])
-   time: clean up redundant check in `Wheel::poll()` ([#&#8203;5574])

##### Documented

-   macros: define cancellation safety ([#&#8203;5525])
-   io: add details to docs of `tokio::io::copy[_buf]` ([#&#8203;5575])
-   io: refer to `ReaderStream` and `StreamReader` in module docs ([#&#8203;5576])

[#&#8203;5512]: tokio-rs/tokio#5512

[#&#8203;5514]: tokio-rs/tokio#5514

[#&#8203;5520]: tokio-rs/tokio#5520

[#&#8203;5525]: tokio-rs/tokio#5525

[#&#8203;5527]: tokio-rs/tokio#5527

[#&#8203;5540]: tokio-rs/tokio#5540

[#&#8203;5543]: tokio-rs/tokio#5543

[#&#8203;5553]: tokio-rs/tokio#5553

[#&#8203;5555]: tokio-rs/tokio#5555

[#&#8203;5557]: tokio-rs/tokio#5557

[#&#8203;5558]: tokio-rs/tokio#5558

[#&#8203;5559]: tokio-rs/tokio#5559

[#&#8203;5572]: tokio-rs/tokio#5572

[#&#8203;5573]: tokio-rs/tokio#5573

[#&#8203;5574]: tokio-rs/tokio#5574

[#&#8203;5575]: tokio-rs/tokio#5575

[#&#8203;5576]: tokio-rs/tokio#5576

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4yNC41IiwidXBkYXRlZEluVmVyIjoiMzUuMjQuNSJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1838
Reviewed-by: crapStone <crapstone@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-net Module: tokio/net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: UdpSocket::peek_sender()
3 participants