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

Side by Side Diff: net/spdy/spdy_session.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/linked_ptr.h" 8 #include "base/linked_ptr.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 state_ = CLOSED; 191 state_ = CLOSED;
192 192
193 // Cleanup all the streams. 193 // Cleanup all the streams.
194 CloseAllStreams(net::ERR_ABORTED); 194 CloseAllStreams(net::ERR_ABORTED);
195 195
196 if (connection_->is_initialized()) { 196 if (connection_->is_initialized()) {
197 // With Spdy we can't recycle sockets. 197 // With Spdy we can't recycle sockets.
198 connection_->socket()->Disconnect(); 198 connection_->socket()->Disconnect();
199 } 199 }
200 200
201 // Streams should all be gone now.
202 DCHECK_EQ(0u, num_active_streams());
203 DCHECK_EQ(0u, num_unclaimed_pushed_streams());
204
201 RecordHistograms(); 205 RecordHistograms();
202 206
203 net_log_.EndEvent(NetLog::TYPE_SPDY_SESSION, NULL); 207 net_log_.EndEvent(NetLog::TYPE_SPDY_SESSION, NULL);
204 } 208 }
205 209
206 net::Error SpdySession::InitializeWithSocket( 210 net::Error SpdySession::InitializeWithSocket(
207 ClientSocketHandle* connection, 211 ClientSocketHandle* connection,
208 bool is_secure, 212 bool is_secure,
209 int certificate_error_code) { 213 int certificate_error_code) {
210 static StatsCounter spdy_sessions("spdy.sessions"); 214 static StatsCounter spdy_sessions("spdy.sessions");
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 LOG(INFO) << "Closing all SPDY Streams for " << host_port_pair().ToString(); 778 LOG(INFO) << "Closing all SPDY Streams for " << host_port_pair().ToString();
775 779
776 static StatsCounter abandoned_streams("spdy.abandoned_streams"); 780 static StatsCounter abandoned_streams("spdy.abandoned_streams");
777 static StatsCounter abandoned_push_streams("spdy.abandoned_push_streams"); 781 static StatsCounter abandoned_push_streams("spdy.abandoned_push_streams");
778 782
779 if (!active_streams_.empty()) 783 if (!active_streams_.empty())
780 abandoned_streams.Add(active_streams_.size()); 784 abandoned_streams.Add(active_streams_.size());
781 if (!unclaimed_pushed_streams_.empty()) { 785 if (!unclaimed_pushed_streams_.empty()) {
782 streams_abandoned_count_ += unclaimed_pushed_streams_.size(); 786 streams_abandoned_count_ += unclaimed_pushed_streams_.size();
783 abandoned_push_streams.Add(unclaimed_pushed_streams_.size()); 787 abandoned_push_streams.Add(unclaimed_pushed_streams_.size());
788 unclaimed_pushed_streams_.clear();
784 } 789 }
785 790
786 for (int i = 0;i < NUM_PRIORITIES;++i) { 791 for (int i = 0;i < NUM_PRIORITIES;++i) {
787 while (!create_stream_queues_[i].empty()) { 792 while (!create_stream_queues_[i].empty()) {
788 PendingCreateStream& pending_create = create_stream_queues_[i].front(); 793 PendingCreateStream& pending_create = create_stream_queues_[i].front();
789 pending_create.callback->Run(ERR_ABORTED); 794 pending_create.callback->Run(ERR_ABORTED);
790 create_stream_queues_[i].pop(); 795 create_stream_queues_[i].pop();
791 } 796 }
792 } 797 }
793 798
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 852
848 void SpdySession::ActivateStream(SpdyStream* stream) { 853 void SpdySession::ActivateStream(SpdyStream* stream) {
849 const spdy::SpdyStreamId id = stream->stream_id(); 854 const spdy::SpdyStreamId id = stream->stream_id();
850 DCHECK(!IsStreamActive(id)); 855 DCHECK(!IsStreamActive(id));
851 856
852 active_streams_[id] = stream; 857 active_streams_[id] = stream;
853 } 858 }
854 859
855 void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) { 860 void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) {
856 DLOG(INFO) << "Removing SpdyStream " << id << " from active stream list."; 861 DLOG(INFO) << "Removing SpdyStream " << id << " from active stream list.";
857 // Remove the stream from unclaimed_pushed_streams_ and active_streams_. 862
858 PushedStreamMap::iterator it; 863 // For push streams, if they are being deleted normally, we leave
859 for (it = unclaimed_pushed_streams_.begin(); 864 // the stream in the unclaimed_pushed_streams_ list. However, if
860 it != unclaimed_pushed_streams_.end(); ++it) { 865 // the stream is errored out, clean it up entirely.
861 scoped_refptr<SpdyStream> curr = it->second; 866 if (status != OK) {
862 if (id == curr->stream_id()) { 867 PushedStreamMap::iterator it;
863 unclaimed_pushed_streams_.erase(it); 868 for (it = unclaimed_pushed_streams_.begin();
864 break; 869 it != unclaimed_pushed_streams_.end(); ++it) {
870 scoped_refptr<SpdyStream> curr = it->second;
871 if (id == curr->stream_id()) {
872 unclaimed_pushed_streams_.erase(it);
873 break;
874 }
865 } 875 }
866 } 876 }
867 877
868 // The stream might have been deleted. 878 // The stream might have been deleted.
869 ActiveStreamMap::iterator it2 = active_streams_.find(id); 879 ActiveStreamMap::iterator it2 = active_streams_.find(id);
870 if (it2 == active_streams_.end()) 880 if (it2 == active_streams_.end())
871 return; 881 return;
872 882
873 // If this is an active stream, call the callback. 883 // If this is an active stream, call the callback.
874 const scoped_refptr<SpdyStream> stream(it2->second); 884 const scoped_refptr<SpdyStream> stream(it2->second);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRetransRate", 1328 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRetransRate",
1319 setting.second, 1329 setting.second,
1320 1, 100, 50); 1330 1, 100, 50);
1321 break; 1331 break;
1322 } 1332 }
1323 } 1333 }
1324 } 1334 }
1325 } 1335 }
1326 1336
1327 } // namespace net 1337 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698