Skip to content

Commit 7299304

Browse files
committed
Merge branch 'tokio-1.23.x' into master
2 parents c6552c5 + 1a997ff commit 7299304

File tree

5 files changed

+83
-8
lines changed

5 files changed

+83
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Make sure you activated the full features of the tokio crate on Cargo.toml:
5656

5757
```toml
5858
[dependencies]
59-
tokio = { version = "1.23.0", features = ["full"] }
59+
tokio = { version = "1.23.1", features = ["full"] }
6060
```
6161
Then, on your main.rs:
6262

tokio/CHANGELOG.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 1.23.1 (January 4, 2022)
2+
3+
This release forward ports changes from 1.18.4.
4+
5+
### Fixed
6+
7+
- net: fix Windows named pipe server builder to maintain option when toggling
8+
pipe mode ([#5336]).
9+
10+
[#5336]: https://github.com/tokio-rs/tokio/pull/5336
11+
112
# 1.23.0 (December 5, 2022)
213

314
### Fixed
@@ -262,6 +273,17 @@ wasm32-wasi target is given unstable support for the `net` feature.
262273
[#4956]: https://github.com/tokio-rs/tokio/pull/4956
263274
[#4959]: https://github.com/tokio-rs/tokio/pull/4959
264275

276+
# 1.20.3 (January 3, 2022)
277+
278+
This release forward ports changes from 1.18.4.
279+
280+
### Fixed
281+
282+
- net: fix Windows named pipe server builder to maintain option when toggling
283+
pipe mode ([#5336]).
284+
285+
[#5336]: https://github.com/tokio-rs/tokio/pull/5336
286+
265287
# 1.20.2 (September 27, 2022)
266288

267289
This release removes the dependency on the `once_cell` crate to restore the MSRV
@@ -387,6 +409,15 @@ This release fixes a bug in `Notified::enable`. ([#4747])
387409
[#4729]: https://github.com/tokio-rs/tokio/pull/4729
388410
[#4739]: https://github.com/tokio-rs/tokio/pull/4739
389411

412+
# 1.18.4 (January 3, 2022)
413+
414+
### Fixed
415+
416+
- net: fix Windows named pipe server builder to maintain option when toggling
417+
pipe mode ([#5336]).
418+
419+
[#5336]: https://github.com/tokio-rs/tokio/pull/5336
420+
390421
# 1.18.3 (September 27, 2022)
391422

392423
This release removes the dependency on the `once_cell` crate to restore the MSRV

tokio/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "tokio"
66
# - README.md
77
# - Update CHANGELOG.md.
88
# - Create "v1.x.y" git tag.
9-
version = "1.23.0"
9+
version = "1.23.1"
1010
edition = "2018"
1111
rust-version = "1.49"
1212
authors = ["Tokio Contributors <[email protected]>"]

tokio/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Make sure you activated the full features of the tokio crate on Cargo.toml:
5656

5757
```toml
5858
[dependencies]
59-
tokio = { version = "1.23.0", features = ["full"] }
59+
tokio = { version = "1.23.1", features = ["full"] }
6060
```
6161
Then, on your main.rs:
6262

tokio/src/net/windows/named_pipe.rs

+49-5
Original file line numberDiff line numberDiff line change
@@ -1705,11 +1705,10 @@ impl ServerOptions {
17051705
///
17061706
/// [`dwPipeMode`]: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea
17071707
pub fn pipe_mode(&mut self, pipe_mode: PipeMode) -> &mut Self {
1708-
self.pipe_mode = match pipe_mode {
1709-
PipeMode::Byte => windows_sys::PIPE_TYPE_BYTE,
1710-
PipeMode::Message => windows_sys::PIPE_TYPE_MESSAGE,
1711-
};
1712-
1708+
let is_msg = matches!(pipe_mode, PipeMode::Message);
1709+
// Pipe mode is implemented as a bit flag 0x4. Set is message and unset
1710+
// is byte.
1711+
bool_flag!(self.pipe_mode, is_msg, windows_sys::PIPE_TYPE_MESSAGE);
17131712
self
17141713
}
17151714

@@ -2554,3 +2553,48 @@ unsafe fn named_pipe_info(handle: RawHandle) -> io::Result<PipeInfo> {
25542553
max_instances,
25552554
})
25562555
}
2556+
2557+
#[cfg(test)]
2558+
mod test {
2559+
use self::windows_sys::{PIPE_REJECT_REMOTE_CLIENTS, PIPE_TYPE_BYTE, PIPE_TYPE_MESSAGE};
2560+
use super::*;
2561+
2562+
#[test]
2563+
fn opts_default_pipe_mode() {
2564+
let opts = ServerOptions::new();
2565+
assert_eq!(opts.pipe_mode, PIPE_TYPE_BYTE | PIPE_REJECT_REMOTE_CLIENTS);
2566+
}
2567+
2568+
#[test]
2569+
fn opts_unset_reject_remote() {
2570+
let mut opts = ServerOptions::new();
2571+
opts.reject_remote_clients(false);
2572+
assert_eq!(opts.pipe_mode & PIPE_REJECT_REMOTE_CLIENTS, 0);
2573+
}
2574+
2575+
#[test]
2576+
fn opts_set_pipe_mode_maintains_reject_remote_clients() {
2577+
let mut opts = ServerOptions::new();
2578+
opts.pipe_mode(PipeMode::Byte);
2579+
assert_eq!(opts.pipe_mode, PIPE_TYPE_BYTE | PIPE_REJECT_REMOTE_CLIENTS);
2580+
2581+
opts.reject_remote_clients(false);
2582+
opts.pipe_mode(PipeMode::Byte);
2583+
assert_eq!(opts.pipe_mode, PIPE_TYPE_BYTE);
2584+
2585+
opts.reject_remote_clients(true);
2586+
opts.pipe_mode(PipeMode::Byte);
2587+
assert_eq!(opts.pipe_mode, PIPE_TYPE_BYTE | PIPE_REJECT_REMOTE_CLIENTS);
2588+
2589+
opts.reject_remote_clients(false);
2590+
opts.pipe_mode(PipeMode::Message);
2591+
assert_eq!(opts.pipe_mode, PIPE_TYPE_MESSAGE);
2592+
2593+
opts.reject_remote_clients(true);
2594+
opts.pipe_mode(PipeMode::Message);
2595+
assert_eq!(
2596+
opts.pipe_mode,
2597+
PIPE_TYPE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS
2598+
);
2599+
}
2600+
}

0 commit comments

Comments
 (0)