Commit 9db5f3fe authored by Renjie Tang's avatar Renjie Tang Committed by Commit Bot

Use a more error-proof way to send RESET_STREAM in QUIC transport.

Bug: 1123769
Change-Id: I6fb06abfee7868ae4b951f70d80305eaf6755b78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446198Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarVictor Vasiliev <vasilvv@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Auto-Submit: Renjie Tang <renjietang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813622}
parent 3f3e8e80
......@@ -149,11 +149,11 @@ class QuicTransport::Stream final {
}
~Stream() {
if (!incoming_ && !outgoing_) {
auto* stream = incoming_ ? incoming_ : outgoing_;
if (!stream) {
return;
}
transport_->transport_->session()->ResetStream(
id_, quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
stream->Reset(quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
}
private:
......@@ -516,15 +516,13 @@ void QuicTransport::OnIncomingBidirectionalStreamAvailable() {
sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 256 * 1024};
if (mojo::CreateDataPipe(&options, &writable_for_outgoing,
&readable_for_outgoing) != MOJO_RESULT_OK) {
transport_->session()->ResetStream(
stream->id(), quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
stream->Reset(quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
// TODO(yhirano): Error the entire connection.
return;
}
if (mojo::CreateDataPipe(&options, &writable_for_incoming,
&readable_for_incoming) != MOJO_RESULT_OK) {
transport_->session()->ResetStream(
stream->id(), quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
stream->Reset(quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
// TODO(yhirano): Error the entire connection.
return;
}
......@@ -559,8 +557,7 @@ void QuicTransport::OnIncomingUnidirectionalStreamAvailable() {
sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 256 * 1024};
if (mojo::CreateDataPipe(&options, &writable_for_incoming,
&readable_for_incoming) != MOJO_RESULT_OK) {
transport_->session()->ResetStream(
stream->id(), quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
stream->Reset(quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED);
// TODO(yhirano): Error the entire connection.
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment