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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 if (resolver_) | 612 if (resolver_) |
613 return; | 613 return; |
614 | 614 |
615 resolver_ = socket_factory()->CreateAsyncResolver(); | 615 resolver_ = socket_factory()->CreateAsyncResolver(); |
616 resolver_->SignalDone.connect(this, &TurnPort::OnResolveResult); | 616 resolver_->SignalDone.connect(this, &TurnPort::OnResolveResult); |
617 resolver_->Start(address); | 617 resolver_->Start(address); |
618 } | 618 } |
619 | 619 |
620 void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) { | 620 void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) { |
621 ASSERT(resolver == resolver_); | 621 ASSERT(resolver == resolver_); |
| 622 LOG_J(LS_INFO, this) << "TURN host lookup result " << resolver_->GetError(); |
| 623 |
622 // If DNS resolve is failed when trying to connect to the server using TCP, | 624 // If DNS resolve is failed when trying to connect to the server using TCP, |
623 // one of the reason could be due to DNS queries blocked by firewall. | 625 // one of the reason could be due to DNS queries blocked by firewall. |
624 // In such cases we will try to connect to the server with hostname, assuming | 626 // In such cases we will try to connect to the server with hostname, assuming |
625 // socket layer will resolve the hostname through a HTTP proxy (if any). | 627 // socket layer will resolve the hostname through a HTTP proxy (if any). |
626 if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) { | 628 if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) { |
627 if (!CreateTurnClientSocket()) { | 629 if (!CreateTurnClientSocket()) { |
628 OnAllocateError(); | 630 OnAllocateError(); |
629 } | 631 } |
630 return; | 632 return; |
631 } | 633 } |
632 | 634 |
633 // Copy the original server address in |resolved_address|. For TLS based | 635 // Copy the original server address in |resolved_address|. For TLS based |
634 // sockets we need hostname along with resolved address. | 636 // sockets we need hostname along with resolved address. |
635 rtc::SocketAddress resolved_address = server_address_.address; | 637 rtc::SocketAddress resolved_address = server_address_.address; |
636 if (resolver_->GetError() != 0 || | 638 if (resolver_->GetError() != 0 || |
637 !resolver_->GetResolvedAddress(ip().family(), &resolved_address)) { | 639 !resolver_->GetResolvedAddress(ip().family(), &resolved_address)) { |
638 LOG_J(LS_WARNING, this) << "TURN host lookup received error " | |
639 << resolver_->GetError(); | |
640 error_ = resolver_->GetError(); | 640 error_ = resolver_->GetError(); |
641 OnAllocateError(); | 641 OnAllocateError(); |
642 return; | 642 return; |
643 } | 643 } |
644 // Signal needs both resolved and unresolved address. After signal is sent | 644 // Signal needs both resolved and unresolved address. After signal is sent |
645 // we can copy resolved address back into |server_address_|. | 645 // we can copy resolved address back into |server_address_|. |
646 SignalResolvedServerAddress(this, server_address_.address, | 646 SignalResolvedServerAddress(this, server_address_.address, |
647 resolved_address); | 647 resolved_address); |
648 server_address_.address = resolved_address; | 648 server_address_.address = resolved_address; |
649 PrepareAddress(); | 649 PrepareAddress(); |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 // bind request as per http://tools.ietf.org/html/rfc5766#section-11.3 | 1419 // bind request as per http://tools.ietf.org/html/rfc5766#section-11.3 |
1420 if (code == STUN_ERROR_STALE_NONCE) { | 1420 if (code == STUN_ERROR_STALE_NONCE) { |
1421 if (port_->UpdateNonce(response)) { | 1421 if (port_->UpdateNonce(response)) { |
1422 // Send channel bind request with fresh nonce. | 1422 // Send channel bind request with fresh nonce. |
1423 SendChannelBindRequest(0); | 1423 SendChannelBindRequest(0); |
1424 } | 1424 } |
1425 } | 1425 } |
1426 } | 1426 } |
1427 | 1427 |
1428 } // namespace cricket | 1428 } // namespace cricket |
OLD | NEW |