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

Side by Side Diff: net/quic/quic_client_session.cc

Issue 284303007: Don't close already closed connections in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/quic/quic_client_session.h" 5 #include "net/quic/quic_client_session.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 QuicErrorCode quic_error) { 611 QuicErrorCode quic_error) {
612 if (!callback_.is_null()) { 612 if (!callback_.is_null()) {
613 base::ResetAndReturn(&callback_).Run(net_error); 613 base::ResetAndReturn(&callback_).Run(net_error);
614 } 614 }
615 CloseAllStreams(net_error); 615 CloseAllStreams(net_error);
616 CloseAllObservers(net_error); 616 CloseAllObservers(net_error);
617 net_log_.AddEvent( 617 net_log_.AddEvent(
618 NetLog::TYPE_QUIC_SESSION_CLOSE_ON_ERROR, 618 NetLog::TYPE_QUIC_SESSION_CLOSE_ON_ERROR,
619 NetLog::IntegerCallback("net_error", net_error)); 619 NetLog::IntegerCallback("net_error", net_error));
620 620
621 connection()->CloseConnection(quic_error, false); 621 if (connection()->connected())
622 connection()->CloseConnection(quic_error, false);
622 DCHECK(!connection()->connected()); 623 DCHECK(!connection()->connected());
623 } 624 }
624 625
625 void QuicClientSession::CloseAllStreams(int net_error) { 626 void QuicClientSession::CloseAllStreams(int net_error) {
626 while (!streams()->empty()) { 627 while (!streams()->empty()) {
627 ReliableQuicStream* stream = streams()->begin()->second; 628 ReliableQuicStream* stream = streams()->begin()->second;
628 QuicStreamId id = stream->id(); 629 QuicStreamId id = stream->id();
629 static_cast<QuicReliableClientStream*>(stream)->OnError(net_error); 630 static_cast<QuicReliableClientStream*>(stream)->OnError(net_error);
630 CloseStream(id); 631 CloseStream(id);
631 } 632 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 RecordUnexpectedNotGoingAway(NOTIFY_FACTORY_OF_SESSION_CLOSED); 729 RecordUnexpectedNotGoingAway(NOTIFY_FACTORY_OF_SESSION_CLOSED);
729 730
730 going_away_ = true; 731 going_away_ = true;
731 DCHECK_EQ(0u, GetNumOpenStreams()); 732 DCHECK_EQ(0u, GetNumOpenStreams());
732 // Will delete |this|. 733 // Will delete |this|.
733 if (stream_factory_) 734 if (stream_factory_)
734 stream_factory_->OnSessionClosed(this); 735 stream_factory_->OnSessionClosed(this);
735 } 736 }
736 737
737 } // namespace net 738 } // namespace net
OLDNEW
« 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