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

Side by Side Diff: net/tools/quic/quic_client_base.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 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
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_client_bin.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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/tools/quic/quic_client_base.h" 5 #include "net/tools/quic/quic_client_base.h"
6 6
7 #include "net/quic/core/crypto/quic_random.h" 7 #include "net/quic/core/crypto/quic_random.h"
8 #include "net/quic/core/quic_server_id.h" 8 #include "net/quic/core/quic_server_id.h"
9 #include "net/quic/core/spdy_utils.h" 9 #include "net/quic/core/spdy_utils.h"
10 #include "net/quic/platform/api/quic_logging.h"
10 #include "net/quic/platform/api/quic_text_utils.h" 11 #include "net/quic/platform/api/quic_text_utils.h"
11 12
12 using base::StringPiece; 13 using base::StringPiece;
13 using base::StringToInt; 14 using base::StringToInt;
14 using std::string; 15 using std::string;
15 16
16 namespace net { 17 namespace net {
17 18
18 void QuicClientBase::ClientQuicDataToResend::Resend() { 19 void QuicClientBase::ClientQuicDataToResend::Resend() {
19 client_->SendRequest(*headers_, body_, fin_); 20 client_->SendRequest(*headers_, body_, fin_);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (response_listener_ != nullptr) { 62 if (response_listener_ != nullptr) {
62 response_listener_->OnCompleteResponse(stream->id(), response_headers, 63 response_listener_->OnCompleteResponse(stream->id(), response_headers,
63 client_stream->data()); 64 client_stream->data());
64 } 65 }
65 66
66 // Store response headers and body. 67 // Store response headers and body.
67 if (store_response_) { 68 if (store_response_) {
68 auto status = response_headers.find(":status"); 69 auto status = response_headers.find(":status");
69 if (status == response_headers.end() || 70 if (status == response_headers.end() ||
70 !StringToInt(status->second, &latest_response_code_)) { 71 !StringToInt(status->second, &latest_response_code_)) {
71 LOG(ERROR) << "Invalid response headers"; 72 QUIC_LOG(ERROR) << "Invalid response headers";
72 } 73 }
73 latest_response_headers_ = response_headers.DebugString(); 74 latest_response_headers_ = response_headers.DebugString();
74 latest_response_header_block_ = response_headers.Clone(); 75 latest_response_header_block_ = response_headers.Clone();
75 latest_response_body_ = client_stream->data(); 76 latest_response_body_ = client_stream->data();
76 latest_response_trailers_ = 77 latest_response_trailers_ =
77 client_stream->received_trailers().DebugString(); 78 client_stream->received_trailers().DebugString();
78 } 79 }
79 } 80 }
80 81
81 bool QuicClientBase::Initialize() { 82 bool QuicClientBase::Initialize() {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 265
265 bool QuicClientBase::WaitForEvents() { 266 bool QuicClientBase::WaitForEvents() {
266 DCHECK(connected()); 267 DCHECK(connected());
267 268
268 RunEventLoop(); 269 RunEventLoop();
269 270
270 DCHECK(session() != nullptr); 271 DCHECK(session() != nullptr);
271 if (!connected() && 272 if (!connected() &&
272 session()->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) { 273 session()->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) {
273 DCHECK(FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support); 274 DCHECK(FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support);
274 DVLOG(1) << "Detected stateless reject while waiting for events. " 275 QUIC_DLOG(INFO) << "Detected stateless reject while waiting for events. "
275 << "Attempting to reconnect."; 276 << "Attempting to reconnect.";
276 Connect(); 277 Connect();
277 } 278 }
278 279
279 return session()->num_active_requests() != 0; 280 return session()->num_active_requests() != 0;
280 } 281 }
281 282
282 bool QuicClientBase::MigrateSocket(const QuicIpAddress& new_host) { 283 bool QuicClientBase::MigrateSocket(const QuicIpAddress& new_host) {
283 if (!connected()) { 284 if (!connected()) {
284 return false; 285 return false;
285 } 286 }
(...skipping 23 matching lines...) Expand all
309 } 310 }
310 311
311 bool QuicClientBase::WaitForCryptoHandshakeConfirmed() { 312 bool QuicClientBase::WaitForCryptoHandshakeConfirmed() {
312 DCHECK(connected()); 313 DCHECK(connected());
313 314
314 while (connected() && !session_->IsCryptoHandshakeConfirmed()) { 315 while (connected() && !session_->IsCryptoHandshakeConfirmed()) {
315 WaitForEvents(); 316 WaitForEvents();
316 } 317 }
317 318
318 // If the handshake fails due to a timeout, the connection will be closed. 319 // If the handshake fails due to a timeout, the connection will be closed.
319 LOG_IF(ERROR, !connected()) << "Handshake with server failed."; 320 QUIC_LOG_IF(ERROR, !connected()) << "Handshake with server failed.";
320 return connected(); 321 return connected();
321 } 322 }
322 323
323 bool QuicClientBase::connected() const { 324 bool QuicClientBase::connected() const {
324 return session_.get() && session_->connection() && 325 return session_.get() && session_->connection() &&
325 session_->connection()->connected(); 326 session_->connection()->connected();
326 } 327 }
327 328
328 bool QuicClientBase::goaway_received() const { 329 bool QuicClientBase::goaway_received() const {
329 return session_ != nullptr && session_->goaway_received(); 330 return session_ != nullptr && session_->goaway_received();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 QUIC_BUG_IF(!store_response_) << "Response not stored!"; 478 QUIC_BUG_IF(!store_response_) << "Response not stored!";
478 return latest_response_body_; 479 return latest_response_body_;
479 } 480 }
480 481
481 const string& QuicClientBase::latest_response_trailers() const { 482 const string& QuicClientBase::latest_response_trailers() const {
482 QUIC_BUG_IF(!store_response_) << "Response not stored!"; 483 QUIC_BUG_IF(!store_response_) << "Response not stored!";
483 return latest_response_trailers_; 484 return latest_response_trailers_;
484 } 485 }
485 486
486 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698