| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; | 58 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; |
| 59 | 59 |
| 60 namespace net { | 60 namespace net { |
| 61 | 61 |
| 62 namespace { | 62 namespace { |
| 63 | 63 |
| 64 enum CreateSessionFailure { | 64 enum CreateSessionFailure { |
| 65 CREATION_ERROR_CONNECTING_SOCKET, | 65 CREATION_ERROR_CONNECTING_SOCKET, |
| 66 CREATION_ERROR_SETTING_RECEIVE_BUFFER, | 66 CREATION_ERROR_SETTING_RECEIVE_BUFFER, |
| 67 CREATION_ERROR_SETTING_SEND_BUFFER, | 67 CREATION_ERROR_SETTING_SEND_BUFFER, |
| 68 CREATION_ERROR_SETTING_NO_NOT_FRAGMENT, |
| 68 CREATION_ERROR_MAX | 69 CREATION_ERROR_MAX |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 enum QuicConnectionMigrationStatus { | 72 enum QuicConnectionMigrationStatus { |
| 72 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, | 73 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, |
| 73 MIGRATION_STATUS_ALREADY_MIGRATED, | 74 MIGRATION_STATUS_ALREADY_MIGRATED, |
| 74 MIGRATION_STATUS_INTERNAL_ERROR, | 75 MIGRATION_STATUS_INTERNAL_ERROR, |
| 75 MIGRATION_STATUS_TOO_MANY_CHANGES, | 76 MIGRATION_STATUS_TOO_MANY_CHANGES, |
| 76 MIGRATION_STATUS_SUCCESS, | 77 MIGRATION_STATUS_SUCCESS, |
| 77 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, | 78 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); | 1606 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); |
| 1606 return rv; | 1607 return rv; |
| 1607 } | 1608 } |
| 1608 | 1609 |
| 1609 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); | 1610 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); |
| 1610 if (rv != OK) { | 1611 if (rv != OK) { |
| 1611 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1612 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 1612 return rv; | 1613 return rv; |
| 1613 } | 1614 } |
| 1614 | 1615 |
| 1616 rv = socket->SetDoNotFragment(true); |
| 1617 if (rv != OK) { |
| 1618 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_NO_NOT_FRAGMENT); |
| 1619 return rv; |
| 1620 } |
| 1621 |
| 1615 // Set a buffer large enough to contain the initial CWND's worth of packet | 1622 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 1616 // to work around the problem with CHLO packets being sent out with the | 1623 // to work around the problem with CHLO packets being sent out with the |
| 1617 // wrong encryption level, when the send buffer is full. | 1624 // wrong encryption level, when the send buffer is full. |
| 1618 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1625 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 1619 if (rv != OK) { | 1626 if (rv != OK) { |
| 1620 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1627 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 1621 return rv; | 1628 return rv; |
| 1622 } | 1629 } |
| 1623 | 1630 |
| 1624 socket->GetLocalAddress(&local_address_); | 1631 socket->GetLocalAddress(&local_address_); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 // Since the session was active, there's no longer an | 1911 // Since the session was active, there's no longer an |
| 1905 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1912 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1906 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1913 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1907 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1914 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1908 // still race. | 1915 // still race. |
| 1909 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1916 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1910 alternative_service); | 1917 alternative_service); |
| 1911 } | 1918 } |
| 1912 | 1919 |
| 1913 } // namespace net | 1920 } // namespace net |
| OLD | NEW |