Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: net/quic/chromium/bidirectional_stream_quic_impl.cc

Issue 2851293002: Change the way BidirectionalStreamQuicImpl detects that a stream/session (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+ ResetStream();
}
void BidirectionalStreamQuicImpl::OnError(int error) {
@@ -350,6 +361,11 @@ void BidirectionalStreamQuicImpl::NotifyStreamReady() {
}
void BidirectionalStreamQuicImpl::ResetStream() {
+ if (session_) {
+ session_->RemoveObserver(this);
+ session_ = nullptr;
+ }
+
if (!stream_)
return;
closed_stream_received_bytes_ = stream_->stream_bytes_read();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698