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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 : Port(thread, | 193 : Port(thread, |
194 RELAY_PORT_TYPE, | 194 RELAY_PORT_TYPE, |
195 factory, | 195 factory, |
196 network, | 196 network, |
197 socket->GetLocalAddress().ipaddr(), | 197 socket->GetLocalAddress().ipaddr(), |
198 username, | 198 username, |
199 password), | 199 password), |
200 server_address_(server_address), | 200 server_address_(server_address), |
201 credentials_(credentials), | 201 credentials_(credentials), |
202 socket_(socket), | 202 socket_(socket), |
203 resolver_(NULL), | 203 resolver_(), |
tommi
2017/06/19 13:01:47
nit: remove from the initializer list since it'll
nisse-webrtc
2017/06/19 14:07:20
Done. Here and below.
| |
204 error_(0), | 204 error_(0), |
205 request_manager_(thread), | 205 request_manager_(thread), |
206 next_channel_number_(TURN_CHANNEL_NUMBER_START), | 206 next_channel_number_(TURN_CHANNEL_NUMBER_START), |
207 state_(STATE_CONNECTING), | 207 state_(STATE_CONNECTING), |
208 server_priority_(server_priority), | 208 server_priority_(server_priority), |
209 allocate_mismatch_retries_(0) { | 209 allocate_mismatch_retries_(0) { |
210 request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket); | 210 request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket); |
211 request_manager_.set_origin(origin); | 211 request_manager_.set_origin(origin); |
212 } | 212 } |
213 | 213 |
(...skipping 14 matching lines...) Expand all Loading... | |
228 factory, | 228 factory, |
229 network, | 229 network, |
230 ip, | 230 ip, |
231 min_port, | 231 min_port, |
232 max_port, | 232 max_port, |
233 username, | 233 username, |
234 password), | 234 password), |
235 server_address_(server_address), | 235 server_address_(server_address), |
236 credentials_(credentials), | 236 credentials_(credentials), |
237 socket_(NULL), | 237 socket_(NULL), |
238 resolver_(NULL), | 238 resolver_(), |
tommi
2017/06/19 13:01:47
nit: remove (we don't include default constructed
| |
239 error_(0), | 239 error_(0), |
240 request_manager_(thread), | 240 request_manager_(thread), |
241 next_channel_number_(TURN_CHANNEL_NUMBER_START), | 241 next_channel_number_(TURN_CHANNEL_NUMBER_START), |
242 state_(STATE_CONNECTING), | 242 state_(STATE_CONNECTING), |
243 server_priority_(server_priority), | 243 server_priority_(server_priority), |
244 allocate_mismatch_retries_(0) { | 244 allocate_mismatch_retries_(0) { |
245 request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket); | 245 request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket); |
246 request_manager_.set_origin(origin); | 246 request_manager_.set_origin(origin); |
247 } | 247 } |
248 | 248 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 attempted_server_addresses_.insert(server_address_.address); | 672 attempted_server_addresses_.insert(server_address_.address); |
673 return true; | 673 return true; |
674 } | 674 } |
675 | 675 |
676 void TurnPort::ResolveTurnAddress(const rtc::SocketAddress& address) { | 676 void TurnPort::ResolveTurnAddress(const rtc::SocketAddress& address) { |
677 if (resolver_) | 677 if (resolver_) |
678 return; | 678 return; |
679 | 679 |
680 LOG_J(LS_INFO, this) << "Starting TURN host lookup for " | 680 LOG_J(LS_INFO, this) << "Starting TURN host lookup for " |
681 << address.ToSensitiveString(); | 681 << address.ToSensitiveString(); |
682 resolver_ = socket_factory()->CreateAsyncResolver(); | 682 resolver_ = rtc::WrapUnique(socket_factory()->CreateAsyncResolver()); |
683 resolver_->SignalDone.connect(this, &TurnPort::OnResolveResult); | 683 resolver_->SignalDone.connect(this, &TurnPort::OnResolveResult); |
684 resolver_->Start(address); | 684 resolver_->Start(address); |
685 } | 685 } |
686 | 686 |
687 void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) { | 687 void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) { |
688 RTC_DCHECK(resolver == resolver_); | 688 RTC_DCHECK(resolver == resolver_.get()); |
689 // If DNS resolve is failed when trying to connect to the server using TCP, | 689 // If DNS resolve is failed when trying to connect to the server using TCP, |
690 // one of the reason could be due to DNS queries blocked by firewall. | 690 // one of the reason could be due to DNS queries blocked by firewall. |
691 // In such cases we will try to connect to the server with hostname, assuming | 691 // In such cases we will try to connect to the server with hostname, assuming |
692 // socket layer will resolve the hostname through a HTTP proxy (if any). | 692 // socket layer will resolve the hostname through a HTTP proxy (if any). |
693 if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) { | 693 if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) { |
694 if (!CreateTurnClientSocket()) { | 694 if (!CreateTurnClientSocket()) { |
695 OnAllocateError(); | 695 OnAllocateError(); |
696 } | 696 } |
697 return; | 697 return; |
698 } | 698 } |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1582 } else { | 1582 } else { |
1583 state_ = STATE_UNBOUND; | 1583 state_ = STATE_UNBOUND; |
1584 port_->FailAndPruneConnection(ext_addr_); | 1584 port_->FailAndPruneConnection(ext_addr_); |
1585 } | 1585 } |
1586 } | 1586 } |
1587 void TurnEntry::OnChannelBindTimeout() { | 1587 void TurnEntry::OnChannelBindTimeout() { |
1588 state_ = STATE_UNBOUND; | 1588 state_ = STATE_UNBOUND; |
1589 port_->FailAndPruneConnection(ext_addr_); | 1589 port_->FailAndPruneConnection(ext_addr_); |
1590 } | 1590 } |
1591 } // namespace cricket | 1591 } // namespace cricket |
OLD | NEW |