Chromium Code Reviews| Index: net/quic/chromium/bidirectional_stream_quic_impl.cc |
| diff --git a/net/quic/chromium/bidirectional_stream_quic_impl.cc b/net/quic/chromium/bidirectional_stream_quic_impl.cc |
| index 159d1d18cd8c4d7aca60a5991cee919add37f017..338401042803050ed70b7a8e3021b25c2c3a77dc 100644 |
| --- a/net/quic/chromium/bidirectional_stream_quic_impl.cc |
| +++ b/net/quic/chromium/bidirectional_stream_quic_impl.cc |
| @@ -268,15 +268,26 @@ void BidirectionalStreamQuicImpl::OnDataAvailable() { |
| } |
| void BidirectionalStreamQuicImpl::OnClose() { |
| + DCHECK(session_); |
| DCHECK(stream_); |
| - if (stream_->connection_error() == QUIC_NO_ERROR && |
| - stream_->stream_error() == QUIC_STREAM_NO_ERROR) { |
| - ResetStream(); |
| + if (stream_->connection_error() != QUIC_NO_ERROR || |
| + stream_->stream_error() != QUIC_STREAM_NO_ERROR) { |
| + NotifyError(was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR |
| + : ERR_QUIC_HANDSHAKE_FAILED); |
| + return; |
| + } |
| + |
| + if (!stream_->fin_sent() || !stream_->fin_received()) { |
| + // The connection must have been closed by the peer with QUIC_NO_ERROR, |
| + // which is improper. |
| + NotifyError(ERR_UNEXPECTED); |
| return; |
| } |
| - NotifyError(was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR |
| - : ERR_QUIC_HANDSHAKE_FAILED); |
| + |
| + // The connection was closed normally so there is no need to notify |
| + // the delegate. |
|
xunjieli
2017/05/01 20:22:02
nice commenting!
Ryan Hamilton
2017/05/01 21:49:23
Thanks!
|
| + ResetStream(); |
| } |
| void BidirectionalStreamQuicImpl::OnError(int error) { |
| @@ -350,6 +361,11 @@ void BidirectionalStreamQuicImpl::NotifyStreamReady() { |
| } |
| void BidirectionalStreamQuicImpl::ResetStream() { |
| + if (session_) { |
|
xunjieli
2017/05/01 20:22:01
Same question here: if Session guarantees to outli
Ryan Hamilton
2017/05/01 21:49:23
I believe that, like QuicHttpStream, the BidiStrea
xunjieli
2017/05/02 17:32:54
Acknowledged. Ah, I see. CL description mentioned
|
| + session_->RemoveObserver(this); |
| + session_ = nullptr; |
| + } |
| + |
| if (!stream_) |
| return; |
| closed_stream_received_bytes_ = stream_->stream_bytes_read(); |