OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Gets protocol priority: UDP > TCP > SSLTCP. | 51 // Gets protocol priority: UDP > TCP > SSLTCP. |
52 int GetProtocolPriority(cricket::ProtocolType protocol) { | 52 int GetProtocolPriority(cricket::ProtocolType protocol) { |
53 switch (protocol) { | 53 switch (protocol) { |
54 case cricket::PROTO_UDP: | 54 case cricket::PROTO_UDP: |
55 return 2; | 55 return 2; |
56 case cricket::PROTO_TCP: | 56 case cricket::PROTO_TCP: |
57 return 1; | 57 return 1; |
58 case cricket::PROTO_SSLTCP: | 58 case cricket::PROTO_SSLTCP: |
59 return 0; | 59 return 0; |
60 default: | 60 default: |
61 RTC_DCHECK(false); | 61 RTC_NOTREACHED(); |
62 return 0; | 62 return 0; |
63 } | 63 } |
64 } | 64 } |
65 // Gets address family priority: IPv6 > IPv4 > Unspecified. | 65 // Gets address family priority: IPv6 > IPv4 > Unspecified. |
66 int GetAddressFamilyPriority(int ip_family) { | 66 int GetAddressFamilyPriority(int ip_family) { |
67 switch (ip_family) { | 67 switch (ip_family) { |
68 case AF_INET6: | 68 case AF_INET6: |
69 return 2; | 69 return 2; |
70 case AF_INET: | 70 case AF_INET: |
71 return 1; | 71 return 1; |
72 default: | 72 default: |
73 RTC_DCHECK(false); | 73 RTC_NOTREACHED(); |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 // Returns positive if a is better, negative if b is better, and 0 otherwise. | 78 // Returns positive if a is better, negative if b is better, and 0 otherwise. |
79 int ComparePort(const cricket::Port* a, const cricket::Port* b) { | 79 int ComparePort(const cricket::Port* a, const cricket::Port* b) { |
80 int a_protocol = GetProtocolPriority(a->GetProtocol()); | 80 int a_protocol = GetProtocolPriority(a->GetProtocol()); |
81 int b_protocol = GetProtocolPriority(b->GetProtocol()); | 81 int b_protocol = GetProtocolPriority(b->GetProtocol()); |
82 int cmp_protocol = a_protocol - b_protocol; | 82 int cmp_protocol = a_protocol - b_protocol; |
83 if (cmp_protocol != 0) { | 83 if (cmp_protocol != 0) { |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 ServerAddresses servers; | 1518 ServerAddresses servers; |
1519 for (size_t i = 0; i < relays.size(); ++i) { | 1519 for (size_t i = 0; i < relays.size(); ++i) { |
1520 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { | 1520 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { |
1521 servers.insert(relays[i].ports.front().address); | 1521 servers.insert(relays[i].ports.front().address); |
1522 } | 1522 } |
1523 } | 1523 } |
1524 return servers; | 1524 return servers; |
1525 } | 1525 } |
1526 | 1526 |
1527 } // namespace cricket | 1527 } // namespace cricket |
OLD | NEW |