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