| OLD | NEW |
| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 void Port::Construct() { | 189 void Port::Construct() { |
| 190 // TODO(pthatcher): Remove this old behavior once we're sure no one | 190 // TODO(pthatcher): Remove this old behavior once we're sure no one |
| 191 // relies on it. If the username_fragment and password are empty, | 191 // relies on it. If the username_fragment and password are empty, |
| 192 // we should just create one. | 192 // we should just create one. |
| 193 if (ice_username_fragment_.empty()) { | 193 if (ice_username_fragment_.empty()) { |
| 194 ASSERT(password_.empty()); | 194 ASSERT(password_.empty()); |
| 195 ice_username_fragment_ = rtc::CreateRandomString(ICE_UFRAG_LENGTH); | 195 ice_username_fragment_ = rtc::CreateRandomString(ICE_UFRAG_LENGTH); |
| 196 password_ = rtc::CreateRandomString(ICE_PWD_LENGTH); | 196 password_ = rtc::CreateRandomString(ICE_PWD_LENGTH); |
| 197 } | 197 } |
| 198 network_->SignalInactive.connect(this, &Port::OnNetworkInactive); | |
| 199 network_->SignalTypeChanged.connect(this, &Port::OnNetworkTypeChanged); | 198 network_->SignalTypeChanged.connect(this, &Port::OnNetworkTypeChanged); |
| 200 network_cost_ = network_->GetCost(); | 199 network_cost_ = network_->GetCost(); |
| 201 | 200 |
| 202 LOG_J(LS_INFO, this) << "Port created with network cost " << network_cost_; | 201 LOG_J(LS_INFO, this) << "Port created with network cost " << network_cost_; |
| 203 } | 202 } |
| 204 | 203 |
| 205 Port::~Port() { | 204 Port::~Port() { |
| 206 // Delete all of the remaining connections. We copy the list up front | 205 // Delete all of the remaining connections. We copy the list up front |
| 207 // because each deletion will cause it to be modified. | 206 // because each deletion will cause it to be modified. |
| 208 | 207 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 << " to " << addr.ToSensitiveString(); | 644 << " to " << addr.ToSensitiveString(); |
| 646 } | 645 } |
| 647 | 646 |
| 648 void Port::OnMessage(rtc::Message *pmsg) { | 647 void Port::OnMessage(rtc::Message *pmsg) { |
| 649 ASSERT(pmsg->message_id == MSG_DEAD); | 648 ASSERT(pmsg->message_id == MSG_DEAD); |
| 650 if (dead()) { | 649 if (dead()) { |
| 651 Destroy(); | 650 Destroy(); |
| 652 } | 651 } |
| 653 } | 652 } |
| 654 | 653 |
| 655 void Port::OnNetworkInactive(const rtc::Network* network) { | |
| 656 ASSERT(network == network_); | |
| 657 SignalNetworkInactive(this); | |
| 658 } | |
| 659 | |
| 660 void Port::OnNetworkTypeChanged(const rtc::Network* network) { | 654 void Port::OnNetworkTypeChanged(const rtc::Network* network) { |
| 661 ASSERT(network == network_); | 655 ASSERT(network == network_); |
| 662 | 656 |
| 663 UpdateNetworkCost(); | 657 UpdateNetworkCost(); |
| 664 } | 658 } |
| 665 | 659 |
| 666 std::string Port::ToString() const { | 660 std::string Port::ToString() const { |
| 667 std::stringstream ss; | 661 std::stringstream ss; |
| 668 ss << "Port[" << std::hex << this << std::dec << ":" << content_name_ << ":" | 662 ss << "Port[" << std::hex << this << std::dec << ":" << content_name_ << ":" |
| 669 << component_ << ":" << generation_ << ":" << type_ << ":" | 663 << component_ << ":" << generation_ << ":" << type_ << ":" |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 ASSERT(sent < 0); | 1529 ASSERT(sent < 0); |
| 1536 error_ = port_->GetError(); | 1530 error_ = port_->GetError(); |
| 1537 stats_.sent_discarded_packets++; | 1531 stats_.sent_discarded_packets++; |
| 1538 } else { | 1532 } else { |
| 1539 send_rate_tracker_.AddSamples(sent); | 1533 send_rate_tracker_.AddSamples(sent); |
| 1540 } | 1534 } |
| 1541 return sent; | 1535 return sent; |
| 1542 } | 1536 } |
| 1543 | 1537 |
| 1544 } // namespace cricket | 1538 } // namespace cricket |
| OLD | NEW |