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/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 ++stats_.packets_revived; | 1714 ++stats_.packets_revived; |
1715 framer_.ProcessRevivedPacket(&revived_header, | 1715 framer_.ProcessRevivedPacket(&revived_header, |
1716 StringPiece(revived_payload, len)); | 1716 StringPiece(revived_payload, len)); |
1717 } | 1717 } |
1718 | 1718 |
1719 QuicFecGroup* QuicConnection::GetFecGroup() { | 1719 QuicFecGroup* QuicConnection::GetFecGroup() { |
1720 QuicFecGroupNumber fec_group_num = last_header_.fec_group; | 1720 QuicFecGroupNumber fec_group_num = last_header_.fec_group; |
1721 if (fec_group_num == 0) { | 1721 if (fec_group_num == 0) { |
1722 return nullptr; | 1722 return nullptr; |
1723 } | 1723 } |
1724 if (group_map_.count(fec_group_num) == 0) { | 1724 if (!ContainsKey(group_map_, fec_group_num)) { |
1725 if (group_map_.size() >= kMaxFecGroups) { // Too many groups | 1725 if (group_map_.size() >= kMaxFecGroups) { // Too many groups |
1726 if (fec_group_num < group_map_.begin()->first) { | 1726 if (fec_group_num < group_map_.begin()->first) { |
1727 // The group being requested is a group we've seen before and deleted. | 1727 // The group being requested is a group we've seen before and deleted. |
1728 // Don't recreate it. | 1728 // Don't recreate it. |
1729 return nullptr; | 1729 return nullptr; |
1730 } | 1730 } |
1731 // Clear the lowest group number. | 1731 // Clear the lowest group number. |
1732 delete group_map_.begin()->second; | 1732 delete group_map_.begin()->second; |
1733 group_map_.erase(group_map_.begin()); | 1733 group_map_.erase(group_map_.begin()); |
1734 } | 1734 } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 } | 2031 } |
2032 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { | 2032 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { |
2033 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { | 2033 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { |
2034 return true; | 2034 return true; |
2035 } | 2035 } |
2036 } | 2036 } |
2037 return false; | 2037 return false; |
2038 } | 2038 } |
2039 | 2039 |
2040 } // namespace net | 2040 } // namespace net |
OLD | NEW |