OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 // A map manages packets which are transmitted across multiple paths. | 5 // A map manages packets which are transmitted across multiple paths. |
6 // For example, a packet is originally transmitted on path 1 with packet number | 6 // For example, a packet is originally transmitted on path 1 with packet number |
7 // 1. Then this packet is retransmitted on path 2 with packet number 1. (1, 1) | 7 // 1. Then this packet is retransmitted on path 2 with packet number 1. (1, 1) |
8 // and (2, 1) are inserted into this map. Suppose (2, 1) is detected lost and | 8 // and (2, 1) are inserted into this map. Suppose (2, 1) is detected lost and |
9 // gets retransmitted on path 2 with packet 2. (2, 2) will not be inserted | 9 // gets retransmitted on path 2 with packet 2. (2, 2) will not be inserted |
10 // because this transmission does not "across" path compared to (2, 1). | 10 // because this transmission does not "across" path compared to (2, 1). |
11 | 11 |
12 #ifndef NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ | 12 #ifndef NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ |
13 #define NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ | 13 #define NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ |
14 | 14 |
15 #include <deque> | 15 #include <deque> |
16 #include <unordered_map> | 16 #include <unordered_map> |
17 | 17 |
18 #include "base/containers/hash_tables.h" | 18 #include "base/containers/hash_tables.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "net/quic/quic_protocol.h" | 20 #include "net/quic/quic_protocol.h" |
21 #include "net/quic/quic_utils.h" | 21 #include "net/quic/quic_utils.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 typedef std::pair<net::QuicPathId, net::QuicPacketNumber> | 25 typedef std::pair<QuicPathId, QuicPacketNumber> QuicPathIdPacketNumber; |
26 QuicPathIdPacketNumber; | |
27 | 26 |
28 class NET_EXPORT_PRIVATE QuicMultipathTransmissionsMap { | 27 class NET_EXPORT_PRIVATE QuicMultipathTransmissionsMap { |
29 public: | 28 public: |
30 struct QuicPathIdPacketNumberHash { | 29 struct QuicPathIdPacketNumberHash { |
31 size_t operator()(std::pair<QuicPathId, QuicPacketNumber> value) const { | 30 size_t operator()(std::pair<QuicPathId, QuicPacketNumber> value) const { |
32 return QuicUtils::PackPathIdAndPacketNumber(value.first, value.second); | 31 return QuicUtils::PackPathIdAndPacketNumber(value.first, value.second); |
33 } | 32 } |
34 }; | 33 }; |
35 | 34 |
36 typedef std::deque<QuicPathIdPacketNumber> MultipathTransmissionsList; | 35 typedef std::deque<QuicPathIdPacketNumber> MultipathTransmissionsList; |
(...skipping 29 matching lines...) Expand all Loading... |
66 // packet has been transmitted as (1, 1) and (2, 1), two entries are added | 65 // packet has been transmitted as (1, 1) and (2, 1), two entries are added |
67 // to this map and both values point to the same list: {(1, 1), (2, 1)}. | 66 // to this map and both values point to the same list: {(1, 1), (2, 1)}. |
68 // The MultipathTransmissionsList is owned by the transmission which is | 67 // The MultipathTransmissionsList is owned by the transmission which is |
69 // received first (on any path). | 68 // received first (on any path). |
70 MultipathTransmissionsMap transmission_map_; | 69 MultipathTransmissionsMap transmission_map_; |
71 }; | 70 }; |
72 | 71 |
73 } // namespace net | 72 } // namespace net |
74 | 73 |
75 #endif // NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ | 74 #endif // NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ |
OLD | NEW |