| 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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 return rv; | 1699 return rv; |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); | 1702 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); |
| 1703 if (rv != OK) { | 1703 if (rv != OK) { |
| 1704 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1704 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 1705 return rv; | 1705 return rv; |
| 1706 } | 1706 } |
| 1707 | 1707 |
| 1708 rv = socket->SetDoNotFragment(); | 1708 rv = socket->SetDoNotFragment(); |
| 1709 if (rv != OK) { | 1709 // SetDoNotFragment is not implemented on all platforms, so ignore errors. |
| 1710 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_NO_NOT_FRAGMENT); | 1710 if (rv != OK && rv != ERR_NOT_IMPLEMENTED) { |
| 1711 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT); |
| 1711 return rv; | 1712 return rv; |
| 1712 } | 1713 } |
| 1713 | 1714 |
| 1714 // Set a buffer large enough to contain the initial CWND's worth of packet | 1715 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 1715 // to work around the problem with CHLO packets being sent out with the | 1716 // to work around the problem with CHLO packets being sent out with the |
| 1716 // wrong encryption level, when the send buffer is full. | 1717 // wrong encryption level, when the send buffer is full. |
| 1717 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1718 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 1718 if (rv != OK) { | 1719 if (rv != OK) { |
| 1719 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1720 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 1720 return rv; | 1721 return rv; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 // Since the session was active, there's no longer an | 2027 // Since the session was active, there's no longer an |
| 2027 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2028 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 2028 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2029 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 2029 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2030 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 2030 // still race. | 2031 // still race. |
| 2031 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2032 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 2032 alternative_service); | 2033 alternative_service); |
| 2033 } | 2034 } |
| 2034 | 2035 |
| 2035 } // namespace net | 2036 } // namespace net |
| OLD | NEW |