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

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

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