| OLD | NEW |
| 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/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 if (!session_->connection()->connected() && | 531 if (!session_->connection()->connected() && |
| 532 session_->error() == QUIC_PROOF_INVALID) { | 532 session_->error() == QUIC_PROOF_INVALID) { |
| 533 return ERR_QUIC_HANDSHAKE_FAILED; | 533 return ERR_QUIC_HANDSHAKE_FAILED; |
| 534 } | 534 } |
| 535 | 535 |
| 536 return rv; | 536 return rv; |
| 537 } | 537 } |
| 538 | 538 |
| 539 int QuicStreamFactory::Job::DoConnectComplete(int rv) { | 539 int QuicStreamFactory::Job::DoConnectComplete(int rv) { |
| 540 TRACE_EVENT1(kNetTracingCategory, "QuicStreamFactory::Job::DoConnectComplete", |
| 541 "host", key_.destination().host()); |
| 540 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB_CONNECT); | 542 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB_CONNECT); |
| 541 if (session_ && session_->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) { | 543 if (session_ && session_->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) { |
| 542 num_sent_client_hellos_ += session_->GetNumSentClientHellos(); | 544 num_sent_client_hellos_ += session_->GetNumSentClientHellos(); |
| 543 if (num_sent_client_hellos_ >= QuicCryptoClientStream::kMaxClientHellos) | 545 if (num_sent_client_hellos_ >= QuicCryptoClientStream::kMaxClientHellos) |
| 544 return ERR_QUIC_HANDSHAKE_FAILED; | 546 return ERR_QUIC_HANDSHAKE_FAILED; |
| 545 // The handshake was rejected statelessly, so create another connection | 547 // The handshake was rejected statelessly, so create another connection |
| 546 // to resume the handshake. | 548 // to resume the handshake. |
| 547 io_state_ = STATE_CONNECT; | 549 io_state_ = STATE_CONNECT; |
| 548 return OK; | 550 return OK; |
| 549 } | 551 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 580 factory_->CancelRequest(this); | 582 factory_->CancelRequest(this); |
| 581 } | 583 } |
| 582 | 584 |
| 583 int QuicStreamRequest::Request(const HostPortPair& destination, | 585 int QuicStreamRequest::Request(const HostPortPair& destination, |
| 584 PrivacyMode privacy_mode, | 586 PrivacyMode privacy_mode, |
| 585 int cert_verify_flags, | 587 int cert_verify_flags, |
| 586 const GURL& url, | 588 const GURL& url, |
| 587 QuicStringPiece method, | 589 QuicStringPiece method, |
| 588 const NetLogWithSource& net_log, | 590 const NetLogWithSource& net_log, |
| 589 const CompletionCallback& callback) { | 591 const CompletionCallback& callback) { |
| 592 TRACE_EVENT1(kNetTracingCategory, "QuicStreamRequest::Request", "host", |
| 593 destination.host()); |
| 590 DCHECK(callback_.is_null()); | 594 DCHECK(callback_.is_null()); |
| 591 DCHECK(factory_); | 595 DCHECK(factory_); |
| 592 server_id_ = QuicServerId(HostPortPair::FromURL(url), privacy_mode); | 596 server_id_ = QuicServerId(HostPortPair::FromURL(url), privacy_mode); |
| 593 | 597 |
| 594 int rv = factory_->Create(server_id_, destination, cert_verify_flags, url, | 598 int rv = factory_->Create(server_id_, destination, cert_verify_flags, url, |
| 595 method, net_log, this); | 599 method, net_log, this); |
| 596 if (rv == ERR_IO_PENDING) { | 600 if (rv == ERR_IO_PENDING) { |
| 597 net_log_ = net_log; | 601 net_log_ = net_log; |
| 598 callback_ = callback; | 602 callback_ = callback; |
| 599 } else { | 603 } else { |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 // Since the session was active, there's no longer an | 1704 // Since the session was active, there's no longer an |
| 1701 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1705 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1702 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1706 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1703 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1707 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1704 // still race. | 1708 // still race. |
| 1705 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1709 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1706 alternative_service); | 1710 alternative_service); |
| 1707 } | 1711 } |
| 1708 | 1712 |
| 1709 } // namespace net | 1713 } // namespace net |
| OLD | NEW |