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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 // TODO: set local preference value for TCP based candidates. | 202 // TODO: set local preference value for TCP based candidates. |
203 } | 203 } |
204 | 204 |
205 RelayPort::~RelayPort() { | 205 RelayPort::~RelayPort() { |
206 for (size_t i = 0; i < entries_.size(); ++i) | 206 for (size_t i = 0; i < entries_.size(); ++i) |
207 delete entries_[i]; | 207 delete entries_[i]; |
208 thread()->Clear(this); | 208 thread()->Clear(this); |
209 } | 209 } |
210 | 210 |
211 void RelayPort::AddServerAddress(const ProtocolAddress& addr) { | 211 void RelayPort::AddServerAddress(const ProtocolAddress& addr) { |
212 // Since HTTP proxies usually only allow 443, | 212 server_addr_.push_back(addr); |
213 // let's up the priority on PROTO_SSLTCP | |
214 if (addr.proto == PROTO_SSLTCP && | |
215 (proxy().type == rtc::PROXY_HTTPS || | |
216 proxy().type == rtc::PROXY_UNKNOWN)) { | |
217 server_addr_.push_front(addr); | |
218 } else { | |
219 server_addr_.push_back(addr); | |
220 } | |
pthatcher1
2016/12/07 21:29:35
Why did you both changing this? RelayPort is depr
hnsl1
2016/12/12 16:08:13
Done.
| |
221 } | 213 } |
222 | 214 |
223 void RelayPort::AddExternalAddress(const ProtocolAddress& addr) { | 215 void RelayPort::AddExternalAddress(const ProtocolAddress& addr) { |
224 std::string proto_name = ProtoToString(addr.proto); | 216 std::string proto_name = ProtoToString(addr.proto); |
225 for (std::vector<ProtocolAddress>::iterator it = external_addr_.begin(); | 217 for (std::vector<ProtocolAddress>::iterator it = external_addr_.begin(); |
226 it != external_addr_.end(); ++it) { | 218 it != external_addr_.end(); ++it) { |
227 if ((it->address == addr.address) && (it->proto == addr.proto)) { | 219 if ((it->address == addr.address) && (it->proto == addr.proto)) { |
228 LOG(INFO) << "Redundant relay address: " << proto_name | 220 LOG(INFO) << "Redundant relay address: " << proto_name |
229 << " @ " << addr.address.ToSensitiveString(); | 221 << " @ " << addr.address.ToSensitiveString(); |
230 return; | 222 return; |
231 } | 223 } |
232 } | 224 } |
233 external_addr_.push_back(addr); | 225 external_addr_.push_back(addr); |
234 } | 226 } |
235 | 227 |
236 void RelayPort::SetReady() { | 228 void RelayPort::SetReady() { |
237 if (!ready_) { | 229 if (!ready_) { |
238 std::vector<ProtocolAddress>::iterator iter; | 230 std::vector<ProtocolAddress>::iterator iter; |
239 for (iter = external_addr_.begin(); | 231 for (iter = external_addr_.begin(); |
240 iter != external_addr_.end(); ++iter) { | 232 iter != external_addr_.end(); ++iter) { |
241 std::string proto_name = ProtoToString(iter->proto); | 233 std::string proto_name = ProtoToString(iter->proto); |
242 // In case of Gturn, related address is set to null socket address. | 234 // In case of Gturn, related address is set to null socket address. |
243 // This is due to as mapped address stun attribute is used for allocated | 235 // This is due to as mapped address stun attribute is used for allocated |
244 // address. | 236 // address. |
245 AddAddress(iter->address, iter->address, rtc::SocketAddress(), proto_name, | 237 AddAddress(iter->address, iter->address, rtc::SocketAddress(), proto_name, |
246 proto_name, "", RELAY_PORT_TYPE, ICE_TYPE_PREFERENCE_RELAY, 0, | 238 proto_name, "", RELAY_PORT_TYPE, ICE_TYPE_PREFERENCE_RELAY_UDP, |
247 false); | 239 0, false); |
248 } | 240 } |
249 ready_ = true; | 241 ready_ = true; |
250 SignalPortComplete(this); | 242 SignalPortComplete(this); |
251 } | 243 } |
252 } | 244 } |
253 | 245 |
254 const ProtocolAddress * RelayPort::ServerAddress(size_t index) const { | 246 const ProtocolAddress * RelayPort::ServerAddress(size_t index) const { |
255 if (index < server_addr_.size()) | 247 if (index < server_addr_.size()) |
256 return &server_addr_[index]; | 248 return &server_addr_[index]; |
257 return NULL; | 249 return NULL; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) | 829 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) |
838 entry_->ScheduleKeepAlive(); | 830 entry_->ScheduleKeepAlive(); |
839 } | 831 } |
840 | 832 |
841 void AllocateRequest::OnTimeout() { | 833 void AllocateRequest::OnTimeout() { |
842 LOG(INFO) << "Allocate request timed out"; | 834 LOG(INFO) << "Allocate request timed out"; |
843 entry_->HandleConnectFailure(connection_->socket()); | 835 entry_->HandleConnectFailure(connection_->socket()); |
844 } | 836 } |
845 | 837 |
846 } // namespace cricket | 838 } // namespace cricket |
OLD | NEW |