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

Unified Diff: net/spdy/spdy_stream.cc

Issue 3108038: Fix bug where pushed SPDY streams were never actually closed.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Will's comments Created 10 years, 4 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 | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_stream.cc
===================================================================
--- net/spdy/spdy_stream.cc (revision 57015)
+++ net/spdy/spdy_stream.cc (working copy)
@@ -29,11 +29,12 @@
response_status_(OK),
cancelled_(false),
send_bytes_(0),
- recv_bytes_(0),
- histograms_recorded_(false) {}
+ recv_bytes_(0) {
+}
SpdyStream::~SpdyStream() {
DLOG(INFO) << "Deleting SpdyStream for stream " << stream_id_;
+ UpdateHistograms();
}
void SpdyStream::SetDelegate(Delegate* delegate) {
@@ -183,9 +184,12 @@
IOBufferWithSize* buf = new IOBufferWithSize(length);
memcpy(buf->data(), data, length);
pending_buffers_.push_back(buf);
- }
- else
+ } else {
pending_buffers_.push_back(NULL);
+ metrics_.StopStream();
+ session_->CloseStream(stream_id_, net::OK);
+ // Note: |this| may be deleted after calling CloseStream.
+ }
return;
}
@@ -202,9 +206,8 @@
// A zero-length read means that the stream is being closed.
if (!length) {
metrics_.StopStream();
- scoped_refptr<SpdyStream> self(this);
session_->CloseStream(stream_id_, net::OK);
- UpdateHistograms();
+ // Note: |this| may be deleted after calling CloseStream.
return;
}
@@ -419,11 +422,6 @@
}
void SpdyStream::UpdateHistograms() {
- if (histograms_recorded_)
- return;
-
- histograms_recorded_ = true;
-
// We need all timers to be filled in, otherwise metrics can be bogus.
if (send_time_.is_null() || recv_first_byte_time_.is_null() ||
recv_last_byte_time_.is_null())
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698