| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; | 60 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; |
| 61 | 61 |
| 62 namespace net { | 62 namespace net { |
| 63 | 63 |
| 64 namespace { | 64 namespace { |
| 65 | 65 |
| 66 enum CreateSessionFailure { | 66 enum CreateSessionFailure { |
| 67 CREATION_ERROR_CONNECTING_SOCKET, | 67 CREATION_ERROR_CONNECTING_SOCKET, |
| 68 CREATION_ERROR_SETTING_RECEIVE_BUFFER, | 68 CREATION_ERROR_SETTING_RECEIVE_BUFFER, |
| 69 CREATION_ERROR_SETTING_SEND_BUFFER, | 69 CREATION_ERROR_SETTING_SEND_BUFFER, |
| 70 CREATION_ERROR_SETTING_NO_NOT_FRAGMENT, | 70 CREATION_ERROR_SETTING_DO_NOT_FRAGMENT, |
| 71 CREATION_ERROR_MAX | 71 CREATION_ERROR_MAX |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 enum QuicConnectionMigrationStatus { | 74 enum QuicConnectionMigrationStatus { |
| 75 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, | 75 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, |
| 76 MIGRATION_STATUS_ALREADY_MIGRATED, | 76 MIGRATION_STATUS_ALREADY_MIGRATED, |
| 77 MIGRATION_STATUS_INTERNAL_ERROR, | 77 MIGRATION_STATUS_INTERNAL_ERROR, |
| 78 MIGRATION_STATUS_TOO_MANY_CHANGES, | 78 MIGRATION_STATUS_TOO_MANY_CHANGES, |
| 79 MIGRATION_STATUS_SUCCESS, | 79 MIGRATION_STATUS_SUCCESS, |
| 80 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, | 80 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 return rv; | 1697 return rv; |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); | 1700 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); |
| 1701 if (rv != OK) { | 1701 if (rv != OK) { |
| 1702 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1702 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 1703 return rv; | 1703 return rv; |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 rv = socket->SetDoNotFragment(); | 1706 rv = socket->SetDoNotFragment(); |
| 1707 if (rv != OK) { | 1707 // SetDoNotFragment is not implemented on all platforms, so ignore errors. |
| 1708 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_NO_NOT_FRAGMENT); | 1708 if (rv != OK && rv != ERR_NOT_IMPLEMENTED) { |
| 1709 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT); |
| 1709 return rv; | 1710 return rv; |
| 1710 } | 1711 } |
| 1711 | 1712 |
| 1712 // Set a buffer large enough to contain the initial CWND's worth of packet | 1713 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 1713 // to work around the problem with CHLO packets being sent out with the | 1714 // to work around the problem with CHLO packets being sent out with the |
| 1714 // wrong encryption level, when the send buffer is full. | 1715 // wrong encryption level, when the send buffer is full. |
| 1715 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1716 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 1716 if (rv != OK) { | 1717 if (rv != OK) { |
| 1717 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1718 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 1718 return rv; | 1719 return rv; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 // Since the session was active, there's no longer an | 2023 // Since the session was active, there's no longer an |
| 2023 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2024 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 2024 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2025 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 2025 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2026 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 2026 // still race. | 2027 // still race. |
| 2027 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2028 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 2028 alternative_service); | 2029 alternative_service); |
| 2029 } | 2030 } |
| 2030 | 2031 |
| 2031 } // namespace net | 2032 } // namespace net |
| OLD | NEW |