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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 void RelayPort::PrepareAddress() { | 270 void RelayPort::PrepareAddress() { |
271 // We initiate a connect on the first entry. If this completes, it will fill | 271 // We initiate a connect on the first entry. If this completes, it will fill |
272 // in the server address as the address of this port. | 272 // in the server address as the address of this port. |
273 ASSERT(entries_.size() == 1); | 273 ASSERT(entries_.size() == 1); |
274 entries_[0]->Connect(); | 274 entries_[0]->Connect(); |
275 ready_ = false; | 275 ready_ = false; |
276 } | 276 } |
277 | 277 |
278 Connection* RelayPort::CreateConnection(const Candidate& address, | 278 Connection* RelayPort::CreateConnection(const Candidate& address, |
279 CandidateOrigin origin) { | 279 CandidateOrigin origin, |
| 280 const IceConfig& config) { |
280 // We only create conns to non-udp sockets if they are incoming on this port | 281 // We only create conns to non-udp sockets if they are incoming on this port |
281 if ((address.protocol() != UDP_PROTOCOL_NAME) && | 282 if ((address.protocol() != UDP_PROTOCOL_NAME) && |
282 (origin != ORIGIN_THIS_PORT)) { | 283 (origin != ORIGIN_THIS_PORT)) { |
283 return 0; | 284 return 0; |
284 } | 285 } |
285 | 286 |
286 // We don't support loopback on relays | 287 // We don't support loopback on relays |
287 if (address.type() == Type()) { | 288 if (address.type() == Type()) { |
288 return 0; | 289 return 0; |
289 } | 290 } |
290 | 291 |
291 if (!IsCompatibleAddress(address.address())) { | 292 if (!IsCompatibleAddress(address.address())) { |
292 return 0; | 293 return 0; |
293 } | 294 } |
294 | 295 |
295 size_t index = 0; | 296 size_t index = 0; |
296 for (size_t i = 0; i < Candidates().size(); ++i) { | 297 for (size_t i = 0; i < Candidates().size(); ++i) { |
297 const Candidate& local = Candidates()[i]; | 298 const Candidate& local = Candidates()[i]; |
298 if (local.protocol() == address.protocol()) { | 299 if (local.protocol() == address.protocol()) { |
299 index = i; | 300 index = i; |
300 break; | 301 break; |
301 } | 302 } |
302 } | 303 } |
303 | 304 |
304 Connection * conn = new ProxyConnection(this, index, address); | 305 Connection* conn = new ProxyConnection(this, index, address, config); |
305 AddOrReplaceConnection(conn); | 306 AddOrReplaceConnection(conn); |
306 return conn; | 307 return conn; |
307 } | 308 } |
308 | 309 |
309 int RelayPort::SendTo(const void* data, size_t size, | 310 int RelayPort::SendTo(const void* data, size_t size, |
310 const rtc::SocketAddress& addr, | 311 const rtc::SocketAddress& addr, |
311 const rtc::PacketOptions& options, | 312 const rtc::PacketOptions& options, |
312 bool payload) { | 313 bool payload) { |
313 // Try to find an entry for this specific address. Note that the first entry | 314 // Try to find an entry for this specific address. Note that the first entry |
314 // created was not given an address initially, so it can be set to the first | 315 // created was not given an address initially, so it can be set to the first |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) | 838 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) |
838 entry_->ScheduleKeepAlive(); | 839 entry_->ScheduleKeepAlive(); |
839 } | 840 } |
840 | 841 |
841 void AllocateRequest::OnTimeout() { | 842 void AllocateRequest::OnTimeout() { |
842 LOG(INFO) << "Allocate request timed out"; | 843 LOG(INFO) << "Allocate request timed out"; |
843 entry_->HandleConnectFailure(connection_->socket()); | 844 entry_->HandleConnectFailure(connection_->socket()); |
844 } | 845 } |
845 | 846 |
846 } // namespace cricket | 847 } // namespace cricket |
OLD | NEW |