| 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 <openssl/aead.h> | 7 #include <openssl/aead.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; | 61 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; |
| 62 | 62 |
| 63 namespace net { | 63 namespace net { |
| 64 | 64 |
| 65 namespace { | 65 namespace { |
| 66 | 66 |
| 67 enum CreateSessionFailure { | 67 enum CreateSessionFailure { |
| 68 CREATION_ERROR_CONNECTING_SOCKET, | 68 CREATION_ERROR_CONNECTING_SOCKET, |
| 69 CREATION_ERROR_SETTING_RECEIVE_BUFFER, | 69 CREATION_ERROR_SETTING_RECEIVE_BUFFER, |
| 70 CREATION_ERROR_SETTING_SEND_BUFFER, | 70 CREATION_ERROR_SETTING_SEND_BUFFER, |
| 71 CREATION_ERROR_SETTING_NO_NOT_FRAGMENT, |
| 71 CREATION_ERROR_MAX | 72 CREATION_ERROR_MAX |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 enum QuicConnectionMigrationStatus { | 75 enum QuicConnectionMigrationStatus { |
| 75 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, | 76 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, |
| 76 MIGRATION_STATUS_ALREADY_MIGRATED, | 77 MIGRATION_STATUS_ALREADY_MIGRATED, |
| 77 MIGRATION_STATUS_INTERNAL_ERROR, | 78 MIGRATION_STATUS_INTERNAL_ERROR, |
| 78 MIGRATION_STATUS_TOO_MANY_CHANGES, | 79 MIGRATION_STATUS_TOO_MANY_CHANGES, |
| 79 MIGRATION_STATUS_SUCCESS, | 80 MIGRATION_STATUS_SUCCESS, |
| 80 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, | 81 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); | 1719 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); |
| 1719 return rv; | 1720 return rv; |
| 1720 } | 1721 } |
| 1721 | 1722 |
| 1722 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); | 1723 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); |
| 1723 if (rv != OK) { | 1724 if (rv != OK) { |
| 1724 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1725 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 1725 return rv; | 1726 return rv; |
| 1726 } | 1727 } |
| 1727 | 1728 |
| 1729 rv = socket->SetDoNotFragment(); |
| 1730 if (rv != OK) { |
| 1731 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_NO_NOT_FRAGMENT); |
| 1732 return rv; |
| 1733 } |
| 1734 |
| 1728 // Set a buffer large enough to contain the initial CWND's worth of packet | 1735 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 1729 // to work around the problem with CHLO packets being sent out with the | 1736 // to work around the problem with CHLO packets being sent out with the |
| 1730 // wrong encryption level, when the send buffer is full. | 1737 // wrong encryption level, when the send buffer is full. |
| 1731 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1738 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 1732 if (rv != OK) { | 1739 if (rv != OK) { |
| 1733 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1740 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 1734 return rv; | 1741 return rv; |
| 1735 } | 1742 } |
| 1736 | 1743 |
| 1737 socket->GetLocalAddress(&local_address_); | 1744 socket->GetLocalAddress(&local_address_); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 // Since the session was active, there's no longer an | 2045 // Since the session was active, there's no longer an |
| 2039 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2046 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 2040 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2047 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 2041 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2048 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 2042 // still race. | 2049 // still race. |
| 2043 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2050 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 2044 alternative_service); | 2051 alternative_service); |
| 2045 } | 2052 } |
| 2046 | 2053 |
| 2047 } // namespace net | 2054 } // namespace net |
| OLD | NEW |