mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
Add a method to test if split streams come from the same stream. (#1762)
* Add a method to test if split streams come from the same stream. The exposed stream ID can also be used as key in associative containers. * Document the fact that split stream IDs can dangle.
This commit is contained in:
committed by
Lucio Franco
parent
3176d0a48a
commit
5bf78d77ad
@@ -45,6 +45,16 @@ fn is_send_and_sync() {
|
||||
assert_bound::<WriteHalf<RW>>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn split_stream_id() {
|
||||
let (r1, w1) = split(RW);
|
||||
let (r2, w2) = split(RW);
|
||||
assert_eq!(r1.stream_id(), w1.stream_id());
|
||||
assert_eq!(r1.stream_id(), w1.stream_id());
|
||||
assert_ne!(r1.stream_id(), w2.stream_id());
|
||||
assert_ne!(r2.stream_id(), w1.stream_id());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsplit_ok() {
|
||||
let (r, w) = split(RW);
|
||||
|
||||
Reference in New Issue
Block a user