Skip to content

Commit

Permalink
remove ProtocolViolation error
Browse files Browse the repository at this point in the history
Follow-up to 1684118.

This error was added in the previous commit, but we can use a more
specific error instead, also to be more consistent with existing code
(e.g. see HANDSHAKE_DONE case).
  • Loading branch information
ghedo committed Jan 15, 2024
1 parent 1684118 commit dfeaa58
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,6 @@ pub enum Error {

/// Error in key update.
KeyUpdate,

/// Protocol error.
ProtocolViolation,
}

impl Error {
Expand All @@ -583,7 +580,6 @@ impl Error {
Error::StreamLimit => 0x4,
Error::FinalSize => 0x6,
Error::KeyUpdate => 0xe,
Error::ProtocolViolation => 0xa,
_ => 0xa,
}
}
Expand All @@ -610,7 +606,6 @@ impl Error {
Error::IdLimit => -17,
Error::OutOfIdentifiers => -18,
Error::KeyUpdate => -19,
Error::ProtocolViolation => -20,
}
}
}
Expand Down Expand Up @@ -6823,7 +6818,7 @@ impl Connection {
// TODO: implement stateless retry
frame::Frame::NewToken { .. } =>
if self.is_server {
return Err(Error::ProtocolViolation);
return Err(Error::InvalidPacket);
},

frame::Frame::Stream { stream_id, data } => {
Expand Down Expand Up @@ -12284,7 +12279,7 @@ mod tests {

assert_eq!(
pipe.server_recv(&mut buf[..written]),
Err(Error::ProtocolViolation)
Err(Error::InvalidPacket)
);
}

Expand Down

0 comments on commit dfeaa58

Please sign in to comment.