OLD | NEW |
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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "net/quic/core/crypto/quic_random.h" | 8 #include "net/quic/core/crypto/quic_random.h" |
9 #include "net/quic/core/quic_server_id.h" | 9 #include "net/quic/core/quic_server_id.h" |
10 #include "net/quic/core/spdy_utils.h" | 10 #include "net/quic/core/spdy_utils.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 void QuicClientBase::WaitForStreamToClose(QuicStreamId id) { | 302 void QuicClientBase::WaitForStreamToClose(QuicStreamId id) { |
303 DCHECK(connected()); | 303 DCHECK(connected()); |
304 | 304 |
305 while (connected() && !session_->IsClosedStream(id)) { | 305 while (connected() && !session_->IsClosedStream(id)) { |
306 WaitForEvents(); | 306 WaitForEvents(); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 void QuicClientBase::WaitForCryptoHandshakeConfirmed() { | 310 bool QuicClientBase::WaitForCryptoHandshakeConfirmed() { |
311 DCHECK(connected()); | 311 DCHECK(connected()); |
312 | 312 |
313 while (connected() && !session_->IsCryptoHandshakeConfirmed()) { | 313 while (connected() && !session_->IsCryptoHandshakeConfirmed()) { |
314 WaitForEvents(); | 314 WaitForEvents(); |
315 } | 315 } |
| 316 |
| 317 // If the handshake fails due to a timeout, the connection will be closed. |
| 318 LOG_IF(ERROR, !connected()) << "Handshake with server failed."; |
| 319 return connected(); |
316 } | 320 } |
317 | 321 |
318 bool QuicClientBase::connected() const { | 322 bool QuicClientBase::connected() const { |
319 return session_.get() && session_->connection() && | 323 return session_.get() && session_->connection() && |
320 session_->connection()->connected(); | 324 session_->connection()->connected(); |
321 } | 325 } |
322 | 326 |
323 bool QuicClientBase::goaway_received() const { | 327 bool QuicClientBase::goaway_received() const { |
324 return session_ != nullptr && session_->goaway_received(); | 328 return session_ != nullptr && session_->goaway_received(); |
325 } | 329 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 QUIC_BUG_IF(!store_response_) << "Response not stored!"; | 476 QUIC_BUG_IF(!store_response_) << "Response not stored!"; |
473 return latest_response_body_; | 477 return latest_response_body_; |
474 } | 478 } |
475 | 479 |
476 const string& QuicClientBase::latest_response_trailers() const { | 480 const string& QuicClientBase::latest_response_trailers() const { |
477 QUIC_BUG_IF(!store_response_) << "Response not stored!"; | 481 QUIC_BUG_IF(!store_response_) << "Response not stored!"; |
478 return latest_response_trailers_; | 482 return latest_response_trailers_; |
479 } | 483 } |
480 | 484 |
481 } // namespace net | 485 } // namespace net |
OLD | NEW |