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

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: add test in quic_stream_factory_test: go away with migration with port only 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return rv; 150 return rv;
151 } 151 }
152 152
153 void QuicChromiumClientSession::StreamRequest::CancelRequest() { 153 void QuicChromiumClientSession::StreamRequest::CancelRequest() {
154 if (session_) 154 if (session_)
155 session_->CancelRequest(this); 155 session_->CancelRequest(this);
156 session_.reset(); 156 session_.reset();
157 callback_.Reset(); 157 callback_.Reset();
158 } 158 }
159 159
160 void QuicChromiumClientSession::StreamRequest::PopulateNetErrorDetails(
161 NetErrorDetails* details) {
162 if (session_)
163 session_->PopulateNetErrorDetails(details);
164 }
165
160 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteSuccess( 166 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteSuccess(
161 QuicChromiumClientStream* stream) { 167 QuicChromiumClientStream* stream) {
162 session_.reset(); 168 session_.reset();
163 *stream_ = stream; 169 *stream_ = stream;
164 base::ResetAndReturn(&callback_).Run(OK); 170 base::ResetAndReturn(&callback_).Run(OK);
165 } 171 }
166 172
167 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteFailure( 173 void QuicChromiumClientSession::StreamRequest::OnRequestCompleteFailure(
168 int rv) { 174 int rv) {
169 session_.reset(); 175 session_.reset();
(...skipping 28 matching lines...) Expand all
198 server_info_(std::move(server_info)), 204 server_info_(std::move(server_info)),
199 num_total_streams_(0), 205 num_total_streams_(0),
200 task_runner_(task_runner), 206 task_runner_(task_runner),
201 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 207 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
202 dns_resolution_end_time_(dns_resolution_end_time), 208 dns_resolution_end_time_(dns_resolution_end_time),
203 logger_(new QuicConnectionLogger(this, 209 logger_(new QuicConnectionLogger(this,
204 connection_description, 210 connection_description,
205 std::move(socket_performance_watcher), 211 std::move(socket_performance_watcher),
206 net_log_)), 212 net_log_)),
207 going_away_(false), 213 going_away_(false),
214 received_goaway_because_of_migrating_port_(false),
208 disabled_reason_(QUIC_DISABLED_NOT), 215 disabled_reason_(QUIC_DISABLED_NOT),
209 token_binding_signatures_(kTokenBindingSignatureMapSize), 216 token_binding_signatures_(kTokenBindingSignatureMapSize),
210 weak_factory_(this) { 217 weak_factory_(this) {
211 sockets_.push_back(std::move(socket)); 218 sockets_.push_back(std::move(socket));
212 packet_readers_.push_back(make_scoped_ptr(new QuicChromiumPacketReader( 219 packet_readers_.push_back(make_scoped_ptr(new QuicChromiumPacketReader(
213 sockets_.back().get(), clock, this, yield_after_packets, 220 sockets_.back().get(), clock, this, yield_after_packets,
214 yield_after_duration, net_log_))); 221 yield_after_duration, net_log_)));
215 crypto_stream_.reset( 222 crypto_stream_.reset(
216 crypto_client_stream_factory->CreateQuicCryptoClientStream( 223 crypto_client_stream_factory->CreateQuicCryptoClientStream(
217 server_id, this, make_scoped_ptr(new ProofVerifyContextChromium( 224 server_id, this, make_scoped_ptr(new ProofVerifyContextChromium(
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 } 760 }
754 761
755 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived( 762 void QuicChromiumClientSession::OnCryptoHandshakeMessageReceived(
756 const CryptoHandshakeMessage& message) { 763 const CryptoHandshakeMessage& message) {
757 logger_->OnCryptoHandshakeMessageReceived(message); 764 logger_->OnCryptoHandshakeMessageReceived(message);
758 } 765 }
759 766
760 void QuicChromiumClientSession::OnGoAway(const QuicGoAwayFrame& frame) { 767 void QuicChromiumClientSession::OnGoAway(const QuicGoAwayFrame& frame) {
761 QuicSession::OnGoAway(frame); 768 QuicSession::OnGoAway(frame);
762 NotifyFactoryOfSessionGoingAway(); 769 NotifyFactoryOfSessionGoingAway();
770 received_goaway_because_of_migrating_port_ =
771 frame.error_code == QUIC_ERROR_MIGRATING_PORT;
763 } 772 }
764 773
765 void QuicChromiumClientSession::OnRstStream(const QuicRstStreamFrame& frame) { 774 void QuicChromiumClientSession::OnRstStream(const QuicRstStreamFrame& frame) {
766 QuicSession::OnRstStream(frame); 775 QuicSession::OnRstStream(frame);
767 OnClosedStream(); 776 OnClosedStream();
768 } 777 }
769 778
770 void QuicChromiumClientSession::OnConnectionClosed( 779 void QuicChromiumClientSession::OnConnectionClosed(
771 QuicErrorCode error, 780 QuicErrorCode error,
772 ConnectionCloseSource source) { 781 ConnectionCloseSource source) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1100 }
1092 // TODO(jri): Make SetQuicPacketWriter take a scoped_ptr. 1101 // TODO(jri): Make SetQuicPacketWriter take a scoped_ptr.
1093 connection()->SetQuicPacketWriter(writer.release(), /*owns_writer=*/true); 1102 connection()->SetQuicPacketWriter(writer.release(), /*owns_writer=*/true);
1094 packet_readers_.push_back(std::move(reader)); 1103 packet_readers_.push_back(std::move(reader));
1095 sockets_.push_back(std::move(socket)); 1104 sockets_.push_back(std::move(socket));
1096 StartReading(); 1105 StartReading();
1097 connection()->SendPing(); 1106 connection()->SendPing();
1098 return true; 1107 return true;
1099 } 1108 }
1100 1109
1110 void QuicChromiumClientSession::PopulateNetErrorDetails(
1111 NetErrorDetails* details) {
1112 details->received_goaway_because_of_migrating_port =
1113 received_goaway_because_of_migrating_port_;
1114 }
1115
1101 const DatagramClientSocket* QuicChromiumClientSession::GetDefaultSocket() 1116 const DatagramClientSocket* QuicChromiumClientSession::GetDefaultSocket()
1102 const { 1117 const {
1103 DCHECK(sockets_.back().get() != nullptr); 1118 DCHECK(sockets_.back().get() != nullptr);
1104 // The most recently added socket is the currently active one. 1119 // The most recently added socket is the currently active one.
1105 return sockets_.back().get(); 1120 return sockets_.back().get();
1106 } 1121 }
1107 1122
1108 bool QuicChromiumClientSession::IsAuthorized(const std::string& hostname) { 1123 bool QuicChromiumClientSession::IsAuthorized(const std::string& hostname) {
1109 return CanPool(hostname, server_id_.privacy_mode()); 1124 return CanPool(hostname, server_id_.privacy_mode());
1110 } 1125 }
1111 1126
1112 bool QuicChromiumClientSession::HasNonMigratableStreams() const { 1127 bool QuicChromiumClientSession::HasNonMigratableStreams() const {
1113 for (const auto& stream : dynamic_streams()) { 1128 for (const auto& stream : dynamic_streams()) {
1114 if (!static_cast<QuicChromiumClientStream*>(stream.second)->can_migrate()) 1129 if (!static_cast<QuicChromiumClientStream*>(stream.second)->can_migrate())
1115 return true; 1130 return true;
1116 } 1131 }
1117 return false; 1132 return false;
1118 } 1133 }
1119 1134
1120 } // namespace net 1135 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698