OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 delete socket_; | 432 delete socket_; |
433 } | 433 } |
434 socket_ = NULL; | 434 socket_ = NULL; |
435 | 435 |
436 ResetNonce(); | 436 ResetNonce(); |
437 PrepareAddress(); | 437 PrepareAddress(); |
438 ++allocate_mismatch_retries_; | 438 ++allocate_mismatch_retries_; |
439 } | 439 } |
440 | 440 |
441 Connection* TurnPort::CreateConnection(const Candidate& address, | 441 Connection* TurnPort::CreateConnection(const Candidate& address, |
442 CandidateOrigin origin) { | 442 CandidateOrigin origin, |
| 443 const IceConfig& config) { |
443 // TURN-UDP can only connect to UDP candidates. | 444 // TURN-UDP can only connect to UDP candidates. |
444 if (!SupportsProtocol(address.protocol())) { | 445 if (!SupportsProtocol(address.protocol())) { |
445 return NULL; | 446 return NULL; |
446 } | 447 } |
447 | 448 |
448 if (!IsCompatibleAddress(address.address())) { | 449 if (!IsCompatibleAddress(address.address())) { |
449 return NULL; | 450 return NULL; |
450 } | 451 } |
451 | 452 |
452 if (state_ == STATE_DISCONNECTED) { | 453 if (state_ == STATE_DISCONNECTED) { |
453 return NULL; | 454 return NULL; |
454 } | 455 } |
455 | 456 |
456 // Create an entry, if needed, so we can get our permissions set up correctly. | 457 // Create an entry, if needed, so we can get our permissions set up correctly. |
457 CreateOrRefreshEntry(address.address()); | 458 CreateOrRefreshEntry(address.address()); |
458 | 459 |
459 // A TURN port will have two candiates, STUN and TURN. STUN may not | 460 // A TURN port will have two candiates, STUN and TURN. STUN may not |
460 // present in all cases. If present stun candidate will be added first | 461 // present in all cases. If present stun candidate will be added first |
461 // and TURN candidate later. | 462 // and TURN candidate later. |
462 for (size_t index = 0; index < Candidates().size(); ++index) { | 463 for (size_t index = 0; index < Candidates().size(); ++index) { |
463 if (Candidates()[index].type() == RELAY_PORT_TYPE) { | 464 if (Candidates()[index].type() == RELAY_PORT_TYPE) { |
464 ProxyConnection* conn = new ProxyConnection(this, index, address); | 465 ProxyConnection* conn = new ProxyConnection(this, index, address, config); |
465 AddOrReplaceConnection(conn); | 466 AddOrReplaceConnection(conn); |
466 return conn; | 467 return conn; |
467 } | 468 } |
468 } | 469 } |
469 return NULL; | 470 return NULL; |
470 } | 471 } |
471 | 472 |
472 bool TurnPort::DestroyConnection(const rtc::SocketAddress& address) { | 473 bool TurnPort::DestroyConnection(const rtc::SocketAddress& address) { |
473 Connection* conn = GetConnection(address); | 474 Connection* conn = GetConnection(address); |
474 if (conn != nullptr) { | 475 if (conn != nullptr) { |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 } else { | 1527 } else { |
1527 state_ = STATE_UNBOUND; | 1528 state_ = STATE_UNBOUND; |
1528 port_->DestroyConnection(ext_addr_); | 1529 port_->DestroyConnection(ext_addr_); |
1529 } | 1530 } |
1530 } | 1531 } |
1531 void TurnEntry::OnChannelBindTimeout() { | 1532 void TurnEntry::OnChannelBindTimeout() { |
1532 state_ = STATE_UNBOUND; | 1533 state_ = STATE_UNBOUND; |
1533 port_->DestroyConnection(ext_addr_); | 1534 port_->DestroyConnection(ext_addr_); |
1534 } | 1535 } |
1535 } // namespace cricket | 1536 } // namespace cricket |
OLD | NEW |