Skip to content

Commit

Permalink
Address more review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Dec 12, 2024
1 parent 190f101 commit 6ea63cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions neqo-transport/src/connection/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
events::ConnectionEvent,
frame::{
FRAME_TYPE_MAX_STREAM_DATA, FRAME_TYPE_RESET_STREAM, FRAME_TYPE_STOP_SENDING,
FRAME_TYPE_STREAM_CLIENT_INI_BIDI, FRAME_TYPE_STREAM_DATA_BLOCKED,
FRAME_TYPE_STREAM_CLIENT_BIDI, FRAME_TYPE_STREAM_DATA_BLOCKED,
},
packet::PacketBuilder,
recv_stream::RECV_BUFFER_SIZE,
Expand Down Expand Up @@ -563,7 +563,15 @@ fn illegal_stream_frames() {
// 0 = Client-Initiated, Bidirectional; 2 = Client-Initiated, Unidirectional
for stream_id in [0, 2] {
// Illegal RESET_STREAM frame
for frame_type in [FRAME_TYPE_RESET_STREAM, ...] {
for frame_type in [
FRAME_TYPE_RESET_STREAM,
FRAME_TYPE_STOP_SENDING,
FRAME_TYPE_MAX_STREAM_DATA,
FRAME_TYPE_STREAM_DATA_BLOCKED,
FRAME_TYPE_STREAM_CLIENT_BIDI,
] {
// The slice contains an extra 0 that is only needed for a RESET_STREAM frame.
// It's ignored for the other frame types as PADDING.
test_with_illegal_frame(&[frame_type, stream_id, 0, 0]);
}
}
Expand Down Expand Up @@ -618,8 +626,7 @@ fn late_stream_related_frame(frame_type: u64) {
let mut server = default_server();
connect(&mut client, &mut server);

// Client creates two streams and sends some data on the second.
_ = client.stream_create(StreamType::BiDi).unwrap();
// Client creates a stream and sends some data.
let stream_id = client.stream_create(StreamType::BiDi).unwrap();
client.stream_send(stream_id, &[0x00]).unwrap();
let out = client.process_output(now());
Expand All @@ -634,7 +641,7 @@ fn late_stream_related_frame(frame_type: u64) {
FRAME_TYPE_STOP_SENDING => {
server.stream_stop_sending(stream_id, 0).unwrap();
}
FRAME_TYPE_STREAM_CLIENT_INI_BIDI => {
FRAME_TYPE_STREAM_CLIENT_BIDI => {
server.stream_send(stream_id, &[0x00]).unwrap();
server.stream_close_send(stream_id).unwrap();
}
Expand Down Expand Up @@ -664,7 +671,7 @@ fn late_stream_related_frame(frame_type: u64) {
FRAME_TYPE_STOP_SENDING => {
assert_eq!(after.stop_sending, before.stop_sending + 1);
}
FRAME_TYPE_STREAM_CLIENT_INI_BIDI => {
FRAME_TYPE_STREAM_CLIENT_BIDI => {
assert_eq!(after.stream, before.stream + 1);
}
FRAME_TYPE_MAX_STREAM_DATA => {
Expand Down Expand Up @@ -698,7 +705,7 @@ fn late_stop_sending_frame() {

#[test]
fn late_stream_frame() {
late_stream_related_frame(FRAME_TYPE_STREAM_CLIENT_INI_BIDI);
late_stream_related_frame(FRAME_TYPE_STREAM_CLIENT_BIDI);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion neqo-transport/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub const FRAME_TYPE_CRYPTO: FrameType = 0x6;
pub const FRAME_TYPE_NEW_TOKEN: FrameType = 0x7;
const FRAME_TYPE_STREAM: FrameType = 0x8;
#[cfg(test)]
pub const FRAME_TYPE_STREAM_CLIENT_INI_BIDI: FrameType = FRAME_TYPE_STREAM;
pub const FRAME_TYPE_STREAM_CLIENT_BIDI: FrameType = FRAME_TYPE_STREAM;
const FRAME_TYPE_STREAM_MAX: FrameType = 0xf;
pub const FRAME_TYPE_MAX_DATA: FrameType = 0x10;
pub const FRAME_TYPE_MAX_STREAM_DATA: FrameType = 0x11;
Expand Down

0 comments on commit 6ea63cc

Please sign in to comment.