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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // connections before TURN candidate added. For that to handle, we need to | 713 // connections before TURN candidate added. For that to handle, we need to |
714 // supply STUN candidate from this port to UDPPort, and TurnPort should have | 714 // supply STUN candidate from this port to UDPPort, and TurnPort should have |
715 // handle to UDPPort to pass back the address. | 715 // handle to UDPPort to pass back the address. |
716 } | 716 } |
717 | 717 |
718 void TurnPort::OnAllocateSuccess(const rtc::SocketAddress& address, | 718 void TurnPort::OnAllocateSuccess(const rtc::SocketAddress& address, |
719 const rtc::SocketAddress& stun_address) { | 719 const rtc::SocketAddress& stun_address) { |
720 state_ = STATE_READY; | 720 state_ = STATE_READY; |
721 | 721 |
722 rtc::SocketAddress related_address = stun_address; | 722 rtc::SocketAddress related_address = stun_address; |
723 if (!(candidate_filter() & CF_REFLEXIVE)) { | |
724 // If candidate filter only allows relay type of address, empty raddr to | |
725 // avoid local address leakage. | |
726 related_address = rtc::EmptySocketAddressWithFamily(stun_address.family()); | |
727 } | |
728 | 723 |
729 // For relayed candidate, Base is the candidate itself. | 724 // For relayed candidate, Base is the candidate itself. |
730 AddAddress(address, // Candidate address. | 725 AddAddress(address, // Candidate address. |
731 address, // Base address. | 726 address, // Base address. |
732 related_address, // Related address. | 727 related_address, // Related address. |
733 UDP_PROTOCOL_NAME, | 728 UDP_PROTOCOL_NAME, |
734 ProtoToString(server_address_.proto), // The first hop protocol. | 729 ProtoToString(server_address_.proto), // The first hop protocol. |
735 "", // TCP canddiate type, empty for turn candidates. | 730 "", // TCP canddiate type, empty for turn candidates. |
736 RELAY_PORT_TYPE, | 731 RELAY_PORT_TYPE, |
737 GetRelayPreference(server_address_.proto, server_address_.secure), | 732 GetRelayPreference(server_address_.proto, server_address_.secure), |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 } else { | 1525 } else { |
1531 state_ = STATE_UNBOUND; | 1526 state_ = STATE_UNBOUND; |
1532 port_->DestroyConnection(ext_addr_); | 1527 port_->DestroyConnection(ext_addr_); |
1533 } | 1528 } |
1534 } | 1529 } |
1535 void TurnEntry::OnChannelBindTimeout() { | 1530 void TurnEntry::OnChannelBindTimeout() { |
1536 state_ = STATE_UNBOUND; | 1531 state_ = STATE_UNBOUND; |
1537 port_->DestroyConnection(ext_addr_); | 1532 port_->DestroyConnection(ext_addr_); |
1538 } | 1533 } |
1539 } // namespace cricket | 1534 } // namespace cricket |
OLD | NEW |