Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: webrtc/p2p/client/basicportallocator.cc

Issue 2122373004: Adding more logging to BasicPortAllocator. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 allocation_sequences_created_ = true; 670 allocation_sequences_created_ = true;
671 // Send candidate allocation complete signal if we have no sequences. 671 // Send candidate allocation complete signal if we have no sequences.
672 MaybeSignalCandidatesAllocationDone(); 672 MaybeSignalCandidatesAllocationDone();
673 } 673 }
674 674
675 void BasicPortAllocatorSession::OnCandidateReady( 675 void BasicPortAllocatorSession::OnCandidateReady(
676 Port* port, const Candidate& c) { 676 Port* port, const Candidate& c) {
677 ASSERT(rtc::Thread::Current() == network_thread_); 677 ASSERT(rtc::Thread::Current() == network_thread_);
678 PortData* data = FindPort(port); 678 PortData* data = FindPort(port);
679 ASSERT(data != NULL); 679 ASSERT(data != NULL);
680 LOG_J(LS_INFO, port) << "Gathered candidate: " << c.ToSensitiveString();
680 // Discarding any candidate signal if port allocation status is 681 // Discarding any candidate signal if port allocation status is
681 // already done with gathering. 682 // already done with gathering.
682 if (!data->inprogress()) { 683 if (!data->inprogress()) {
684 LOG(LS_WARNING)
685 << "Discarding candidate because port is already done gathering.";
683 return; 686 return;
684 } 687 }
685 688
686 // Mark that the port has a pairable candidate, either because we have a 689 // Mark that the port has a pairable candidate, either because we have a
687 // usable candidate from the port, or simply because the port is bound to the 690 // usable candidate from the port, or simply because the port is bound to the
688 // any address and therefore has no host candidate. This will trigger the port 691 // any address and therefore has no host candidate. This will trigger the port
689 // to start creating candidate pairs (connections) and issue connectivity 692 // to start creating candidate pairs (connections) and issue connectivity
690 // checks. If port has already been marked as having a pairable candidate, 693 // checks. If port has already been marked as having a pairable candidate,
691 // do nothing here. 694 // do nothing here.
692 // Note: We should check whether any candidates may become ready after this 695 // Note: We should check whether any candidates may become ready after this
693 // because there we will check whether the candidate is generated by the ready 696 // because there we will check whether the candidate is generated by the ready
694 // ports, which may include this port. 697 // ports, which may include this port.
695 bool pruned_port = false; 698 bool pruned_port = false;
696 if (CandidatePairable(c, port) && !data->has_pairable_candidate()) { 699 if (CandidatePairable(c, port) && !data->has_pairable_candidate()) {
697 data->set_has_pairable_candidate(true); 700 data->set_has_pairable_candidate(true);
698 701
699 if (prune_turn_ports_ && port->Type() == RELAY_PORT_TYPE) { 702 if (prune_turn_ports_ && port->Type() == RELAY_PORT_TYPE) {
700 pruned_port = PruneTurnPorts(port); 703 pruned_port = PruneTurnPorts(port);
701 } 704 }
702 // If the current port is not pruned yet, SignalPortReady. 705 // If the current port is not pruned yet, SignalPortReady.
703 if (!data->pruned()) { 706 if (!data->pruned()) {
707 LOG_J(LS_INFO, port) << "Port ready.";
704 SignalPortReady(this, port); 708 SignalPortReady(this, port);
705 } 709 }
706 } 710 }
707 711
708 ProtocolType pvalue; 712 ProtocolType pvalue;
709 bool candidate_protocol_enabled = 713 bool candidate_protocol_enabled =
710 StringToProto(c.protocol().c_str(), &pvalue) && 714 StringToProto(c.protocol().c_str(), &pvalue) &&
711 data->sequence()->ProtocolEnabled(pvalue); 715 data->sequence()->ProtocolEnabled(pvalue);
712 716
713 if (data->ready() && CheckCandidateFilter(c) && candidate_protocol_enabled) { 717 if (data->ready() && CheckCandidateFilter(c) && candidate_protocol_enabled) {
714 std::vector<Candidate> candidates; 718 std::vector<Candidate> candidates;
715 candidates.push_back(SanitizeRelatedAddress(c)); 719 candidates.push_back(SanitizeRelatedAddress(c));
716 SignalCandidatesReady(this, candidates); 720 SignalCandidatesReady(this, candidates);
721 } else if (!candidate_protocol_enabled) {
722 LOG(LS_INFO)
723 << "Not yet signaling candidate because protocol is not yet enabled.";
724 } else {
725 LOG(LS_INFO) << "Discarding candidate because it doesn't match filter.";
717 } 726 }
718 727
719 // If we have pruned any port, maybe need to signal port allocation done. 728 // If we have pruned any port, maybe need to signal port allocation done.
720 if (pruned_port) { 729 if (pruned_port) {
721 MaybeSignalCandidatesAllocationDone(); 730 MaybeSignalCandidatesAllocationDone();
722 } 731 }
723 } 732 }
724 733
725 Port* BasicPortAllocatorSession::GetBestTurnPortForNetwork( 734 Port* BasicPortAllocatorSession::GetBestTurnPortForNetwork(
726 const std::string& network_name) const { 735 const std::string& network_name) const {
(...skipping 27 matching lines...) Expand all
754 if (data.port() != newly_pairable_turn_port) { 763 if (data.port() != newly_pairable_turn_port) {
755 SignalPortPruned(this, data.port()); 764 SignalPortPruned(this, data.port());
756 } 765 }
757 } 766 }
758 } 767 }
759 return pruned_port; 768 return pruned_port;
760 } 769 }
761 770
762 void BasicPortAllocatorSession::OnPortComplete(Port* port) { 771 void BasicPortAllocatorSession::OnPortComplete(Port* port) {
763 ASSERT(rtc::Thread::Current() == network_thread_); 772 ASSERT(rtc::Thread::Current() == network_thread_);
773 LOG_J(LS_INFO, port) << "Port completed gathering candidates.";
764 PortData* data = FindPort(port); 774 PortData* data = FindPort(port);
765 ASSERT(data != NULL); 775 ASSERT(data != NULL);
766 776
767 // Ignore any late signals. 777 // Ignore any late signals.
768 if (!data->inprogress()) { 778 if (!data->inprogress()) {
769 return; 779 return;
770 } 780 }
771 781
772 // Moving to COMPLETE state. 782 // Moving to COMPLETE state.
773 data->set_complete(); 783 data->set_complete();
774 // Send candidate allocation complete signal if this was the last port. 784 // Send candidate allocation complete signal if this was the last port.
775 MaybeSignalCandidatesAllocationDone(); 785 MaybeSignalCandidatesAllocationDone();
776 } 786 }
777 787
778 void BasicPortAllocatorSession::OnPortError(Port* port) { 788 void BasicPortAllocatorSession::OnPortError(Port* port) {
779 ASSERT(rtc::Thread::Current() == network_thread_); 789 ASSERT(rtc::Thread::Current() == network_thread_);
790 LOG_J(LS_INFO, port) << "Port encountered error while gathering candidates.";
780 PortData* data = FindPort(port); 791 PortData* data = FindPort(port);
781 ASSERT(data != NULL); 792 ASSERT(data != NULL);
782 // We might have already given up on this port and stopped it. 793 // We might have already given up on this port and stopped it.
783 if (!data->inprogress()) { 794 if (!data->inprogress()) {
784 return; 795 return;
785 } 796 }
786 797
787 // SignalAddressError is currently sent from StunPort/TurnPort. 798 // SignalAddressError is currently sent from StunPort/TurnPort.
788 // But this signal itself is generic. 799 // But this signal itself is generic.
789 data->set_error(); 800 data->set_error();
(...skipping 12 matching lines...) Expand all
802 const std::vector<Candidate>& potentials = it->port()->Candidates(); 813 const std::vector<Candidate>& potentials = it->port()->Candidates();
803 for (size_t i = 0; i < potentials.size(); ++i) { 814 for (size_t i = 0; i < potentials.size(); ++i) {
804 if (!CheckCandidateFilter(potentials[i])) { 815 if (!CheckCandidateFilter(potentials[i])) {
805 continue; 816 continue;
806 } 817 }
807 ProtocolType pvalue; 818 ProtocolType pvalue;
808 bool candidate_protocol_enabled = 819 bool candidate_protocol_enabled =
809 StringToProto(potentials[i].protocol().c_str(), &pvalue) && 820 StringToProto(potentials[i].protocol().c_str(), &pvalue) &&
810 pvalue == proto; 821 pvalue == proto;
811 if (candidate_protocol_enabled) { 822 if (candidate_protocol_enabled) {
823 LOG(LS_INFO) << "Signaling candidate because protocol was enabled: "
824 << potentials[i].ToSensitiveString();
812 candidates.push_back(potentials[i]); 825 candidates.push_back(potentials[i]);
813 } 826 }
814 } 827 }
815 } 828 }
816 829
817 if (!candidates.empty()) { 830 if (!candidates.empty()) {
818 SignalCandidatesReady(this, candidates); 831 SignalCandidatesReady(this, candidates);
819 } 832 }
820 } 833 }
821 834
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 ServerAddresses servers; 1431 ServerAddresses servers;
1419 for (size_t i = 0; i < relays.size(); ++i) { 1432 for (size_t i = 0; i < relays.size(); ++i) {
1420 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1433 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1421 servers.insert(relays[i].ports.front().address); 1434 servers.insert(relays[i].ports.front().address);
1422 } 1435 }
1423 } 1436 }
1424 return servers; 1437 return servers;
1425 } 1438 }
1426 1439
1427 } // namespace cricket 1440 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698