Skip to content

Commit

Permalink
Fix #182: Convert error codes before passing them to QUIC
Browse files Browse the repository at this point in the history
  • Loading branch information
barafael committed Sep 3, 2024
1 parent 209a6c9 commit 6707731
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions wtransport/src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl Driver {

stream
.into_stream()
.stop(ErrorCode::BufferedStreamRejected.to_code())
.stop(ErrorCode::BufferedStreamRejected.to_http3())
.expect("Stream not already stopped");
}
}
Expand All @@ -164,7 +164,7 @@ impl Driver {
stream
.into_stream()
.1
.stop(ErrorCode::BufferedStreamRejected.to_code())
.stop(ErrorCode::BufferedStreamRejected.to_http3())
.expect("Stream not already stopped");
}
}
Expand Down Expand Up @@ -308,7 +308,7 @@ mod worker {

if let DriverError::Proto(error_code) = &error {
self.quic_connection
.close(varint_w2q(error_code.to_code()), b"");
.close(varint_w2q(error_code.to_http3()), b"");
}

self.driver_result.set(error);
Expand Down
10 changes: 5 additions & 5 deletions wtransport/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ impl Endpoint<endpoint_side::Client> {
let frame = match stream_session.read_frame().await {
Ok(frame) => frame,
Err(ProtoReadError::H3(error_code)) => {
quic_connection.close(varint_w2q(error_code.to_code()), b"");
quic_connection.close(varint_w2q(error_code.to_http3()), b"");
return Err(ConnectingError::ConnectionError(
ConnectionError::local_h3_error(error_code),
));
Expand All @@ -404,7 +404,7 @@ impl Endpoint<endpoint_side::Client> {
};

if !matches!(frame.kind(), FrameKind::Headers) {
quic_connection.close(varint_w2q(ErrorCode::FrameUnexpected.to_code()), b"");
quic_connection.close(varint_w2q(ErrorCode::FrameUnexpected.to_http3()), b"");
return Err(ConnectingError::ConnectionError(
ConnectionError::local_h3_error(ErrorCode::FrameUnexpected),
));
Expand All @@ -413,7 +413,7 @@ impl Endpoint<endpoint_side::Client> {
let headers = match Headers::with_frame(&frame) {
Ok(headers) => headers,
Err(error_code) => {
quic_connection.close(varint_w2q(error_code.to_code()), b"");
quic_connection.close(varint_w2q(error_code.to_http3()), b"");
return Err(ConnectingError::ConnectionError(
ConnectionError::local_h3_error(error_code),
));
Expand All @@ -423,7 +423,7 @@ impl Endpoint<endpoint_side::Client> {
let session_response = match SessionResponseProto::try_from(headers) {
Ok(session_response) => session_response,
Err(_) => {
quic_connection.close(varint_w2q(ErrorCode::Message.to_code()), b"");
quic_connection.close(varint_w2q(ErrorCode::Message.to_http3()), b"");
return Err(ConnectingError::ConnectionError(
ConnectionError::local_h3_error(ErrorCode::Message),
));
Expand Down Expand Up @@ -759,7 +759,7 @@ impl SessionRequest {
}
Err(ProtoWriteError::Stopped) => {
self.quic_connection
.close(varint_w2q(ErrorCode::ClosedCriticalStream.to_code()), b"");
.close(varint_w2q(ErrorCode::ClosedCriticalStream.to_http3()), b"");

Err(ConnectionError::local_h3_error(
ErrorCode::ClosedCriticalStream,
Expand Down

0 comments on commit 6707731

Please sign in to comment.