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

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

Issue 1775283002: [Domain Reliabiliy: net stack] Plumb received go away from server due to connection migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
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_chromium_client_session.h" 5 #include "net/quic/quic_chromium_client_session.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 server_info_(std::move(server_info)), 198 server_info_(std::move(server_info)),
199 num_total_streams_(0), 199 num_total_streams_(0),
200 task_runner_(task_runner), 200 task_runner_(task_runner),
201 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 201 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
202 dns_resolution_end_time_(dns_resolution_end_time), 202 dns_resolution_end_time_(dns_resolution_end_time),
203 logger_(new QuicConnectionLogger(this, 203 logger_(new QuicConnectionLogger(this,
204 connection_description, 204 connection_description,
205 std::move(socket_performance_watcher), 205 std::move(socket_performance_watcher),
206 net_log_)), 206 net_log_)),
207 going_away_(false), 207 going_away_(false),
208 port_migration_detected_(false),
208 disabled_reason_(QUIC_DISABLED_NOT), 209 disabled_reason_(QUIC_DISABLED_NOT),
209 token_binding_signatures_(kTokenBindingSignatureMapSize), 210 token_binding_signatures_(kTokenBindingSignatureMapSize),
210 weak_factory_(this) { 211 weak_factory_(this) {
211 sockets_.push_back(std::move(socket)); 212 sockets_.push_back(std::move(socket));
212 packet_readers_.push_back(make_scoped_ptr(new QuicChromiumPacketReader( 213 packet_readers_.push_back(make_scoped_ptr(new QuicChromiumPacketReader(
213 sockets_.back().get(), clock, this, yield_after_packets, 214 sockets_.back().get(), clock, this, yield_after_packets,
214 yield_after_duration, net_log_))); 215 yield_after_duration, net_log_)));
215 crypto_stream_.reset( 216 crypto_stream_.reset(
216 crypto_client_stream_factory->CreateQuicCryptoClientStream( 217 crypto_client_stream_factory->CreateQuicCryptoClientStream(
217 server_id, this, make_scoped_ptr(new ProofVerifyContextChromium( 218 server_id, this, make_scoped_ptr(new ProofVerifyContextChromium(
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 } 754 }
754 755
755 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived( 756 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived(
756 const CryptoHandshakeMessage& message) { 757 const CryptoHandshakeMessage& message) {
757 logger_->OnCryptoHandshakeMessageReceived(message); 758 logger_->OnCryptoHandshakeMessageReceived(message);
758 } 759 }
759 760
760 void QuicChromiumClientSession::OnGoAway(const QuicGoAwayFrame& frame) { 761 void QuicChromiumClientSession::OnGoAway(const QuicGoAwayFrame& frame) {
761 QuicSession::OnGoAway(frame); 762 QuicSession::OnGoAway(frame);
762 NotifyFactoryOfSessionGoingAway(); 763 NotifyFactoryOfSessionGoingAway();
764 port_migration_detected_ = frame.error_code == QUIC_ERROR_MIGRATING_PORT;
763 } 765 }
764 766
765 void QuicChromiumClientSession::OnRstStream(const QuicRstStreamFrame& frame) { 767 void QuicChromiumClientSession::OnRstStream(const QuicRstStreamFrame& frame) {
766 QuicSession::OnRstStream(frame); 768 QuicSession::OnRstStream(frame);
767 OnClosedStream(); 769 OnClosedStream();
768 } 770 }
769 771
770 void QuicChromiumClientSession::OnConnectionClosed( 772 void QuicChromiumClientSession::OnConnectionClosed(
771 QuicErrorCode error, 773 QuicErrorCode error,
772 ConnectionCloseSource source) { 774 ConnectionCloseSource source) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1093 }
1092 // TODO(jri): Make SetQuicPacketWriter take a scoped_ptr. 1094 // TODO(jri): Make SetQuicPacketWriter take a scoped_ptr.
1093 connection()->SetQuicPacketWriter(writer.release(), /*owns_writer=*/true); 1095 connection()->SetQuicPacketWriter(writer.release(), /*owns_writer=*/true);
1094 packet_readers_.push_back(std::move(reader)); 1096 packet_readers_.push_back(std::move(reader));
1095 sockets_.push_back(std::move(socket)); 1097 sockets_.push_back(std::move(socket));
1096 StartReading(); 1098 StartReading();
1097 connection()->SendPing(); 1099 connection()->SendPing();
1098 return true; 1100 return true;
1099 } 1101 }
1100 1102
1103 void QuicChromiumClientSession::PopulateNetErrorDetails(
1104 NetErrorDetails* details) {
1105 details->quic_port_migration_detected = port_migration_detected_;
1106 }
1107
1101 const DatagramClientSocket* QuicChromiumClientSession::GetDefaultSocket() 1108 const DatagramClientSocket* QuicChromiumClientSession::GetDefaultSocket()
1102 const { 1109 const {
1103 DCHECK(sockets_.back().get() != nullptr); 1110 DCHECK(sockets_.back().get() != nullptr);
1104 // The most recently added socket is the currently active one. 1111 // The most recently added socket is the currently active one.
1105 return sockets_.back().get(); 1112 return sockets_.back().get();
1106 } 1113 }
1107 1114
1108 bool QuicChromiumClientSession::IsAuthorized(const std::string& hostname) { 1115 bool QuicChromiumClientSession::IsAuthorized(const std::string& hostname) {
1109 return CanPool(hostname, server_id_.privacy_mode()); 1116 return CanPool(hostname, server_id_.privacy_mode());
1110 } 1117 }
1111 1118
1112 bool QuicChromiumClientSession::HasNonMigratableStreams() const { 1119 bool QuicChromiumClientSession::HasNonMigratableStreams() const {
1113 for (const auto& stream : dynamic_streams()) { 1120 for (const auto& stream : dynamic_streams()) {
1114 if (!static_cast<QuicChromiumClientStream*>(stream.second)->can_migrate()) 1121 if (!static_cast<QuicChromiumClientStream*>(stream.second)->can_migrate())
1115 return true; 1122 return true;
1116 } 1123 }
1117 return false; 1124 return false;
1118 } 1125 }
1119 1126
1120 } // namespace net 1127 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698