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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 size_t index, | 880 size_t index, |
881 const Candidate& remote_candidate) | 881 const Candidate& remote_candidate) |
882 : port_(port), | 882 : port_(port), |
883 local_candidate_index_(index), | 883 local_candidate_index_(index), |
884 remote_candidate_(remote_candidate), | 884 remote_candidate_(remote_candidate), |
885 read_state_(STATE_READ_INIT), | 885 read_state_(STATE_READ_INIT), |
886 write_state_(STATE_WRITE_INIT), | 886 write_state_(STATE_WRITE_INIT), |
887 connected_(true), | 887 connected_(true), |
888 pruned_(false), | 888 pruned_(false), |
889 use_candidate_attr_(false), | 889 use_candidate_attr_(false), |
890 nominated_(false), | |
890 remote_ice_mode_(ICEMODE_FULL), | 891 remote_ice_mode_(ICEMODE_FULL), |
891 requests_(port->thread()), | 892 requests_(port->thread()), |
892 rtt_(DEFAULT_RTT), | 893 rtt_(DEFAULT_RTT), |
893 last_ping_sent_(0), | 894 last_ping_sent_(0), |
894 last_ping_received_(0), | 895 last_ping_received_(0), |
895 last_data_received_(0), | 896 last_data_received_(0), |
896 last_ping_response_received_(0), | 897 last_ping_response_received_(0), |
897 sent_packets_discarded_(0), | 898 sent_packets_discarded_(0), |
898 sent_packets_total_(0), | 899 sent_packets_total_(0), |
899 reported_(false), | 900 reported_(false), |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 | 1051 |
1051 // If timed out sending writability checks, start up again | 1052 // If timed out sending writability checks, start up again |
1052 if (!pruned_ && (write_state_ == STATE_WRITE_TIMEOUT)) | 1053 if (!pruned_ && (write_state_ == STATE_WRITE_TIMEOUT)) |
1053 set_write_state(STATE_WRITE_INIT); | 1054 set_write_state(STATE_WRITE_INIT); |
1054 | 1055 |
1055 if ((port_->IsStandardIce()) && | 1056 if ((port_->IsStandardIce()) && |
1056 (port_->GetIceRole() == ICEROLE_CONTROLLED)) { | 1057 (port_->GetIceRole() == ICEROLE_CONTROLLED)) { |
1057 const StunByteStringAttribute* use_candidate_attr = | 1058 const StunByteStringAttribute* use_candidate_attr = |
1058 msg->GetByteString(STUN_ATTR_USE_CANDIDATE); | 1059 msg->GetByteString(STUN_ATTR_USE_CANDIDATE); |
1059 if (use_candidate_attr) | 1060 if (use_candidate_attr) |
1060 SignalUseCandidate(this); | 1061 set_nominated(true); |
1061 } | 1062 } |
1062 } else { | 1063 } else { |
1063 // The packet had the right local username, but the remote username | 1064 // The packet had the right local username, but the remote username |
1064 // was not the right one for the remote address. | 1065 // was not the right one for the remote address. |
1065 LOG_J(LS_ERROR, this) | 1066 LOG_J(LS_ERROR, this) |
1066 << "Received STUN request with bad remote username " | 1067 << "Received STUN request with bad remote username " |
1067 << remote_ufrag; | 1068 << remote_ufrag; |
1068 port_->SendBindingErrorResponse(msg.get(), addr, | 1069 port_->SendBindingErrorResponse(msg.get(), addr, |
1069 STUN_ERROR_UNAUTHORIZED, | 1070 STUN_ERROR_UNAUTHORIZED, |
1070 STUN_ERROR_REASON_UNAUTHORIZED); | 1071 STUN_ERROR_REASON_UNAUTHORIZED); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1466 } | 1467 } |
1467 | 1468 |
1468 size_t Connection::sent_discarded_packets() { | 1469 size_t Connection::sent_discarded_packets() { |
1469 return sent_packets_discarded_; | 1470 return sent_packets_discarded_; |
1470 } | 1471 } |
1471 | 1472 |
1472 size_t Connection::sent_total_packets() { | 1473 size_t Connection::sent_total_packets() { |
1473 return sent_packets_total_; | 1474 return sent_packets_total_; |
1474 } | 1475 } |
1475 | 1476 |
1477 void Connection::set_nominated(bool nominated) { | |
1478 nominated_ = nominated; | |
1479 if (nominated_) { | |
1480 SignalUseCandidate(this); | |
juberti1
2015/08/07 01:31:19
This seems like an unexpected side effect. I would
honghaiz3
2015/08/07 20:42:04
Done.
| |
1481 } | |
1482 } | |
1483 | |
1476 void Connection::MaybeAddPrflxCandidate(ConnectionRequest* request, | 1484 void Connection::MaybeAddPrflxCandidate(ConnectionRequest* request, |
1477 StunMessage* response) { | 1485 StunMessage* response) { |
1478 // RFC 5245 | 1486 // RFC 5245 |
1479 // The agent checks the mapped address from the STUN response. If the | 1487 // The agent checks the mapped address from the STUN response. If the |
1480 // transport address does not match any of the local candidates that the | 1488 // transport address does not match any of the local candidates that the |
1481 // agent knows about, the mapped address represents a new candidate -- a | 1489 // agent knows about, the mapped address represents a new candidate -- a |
1482 // peer reflexive candidate. | 1490 // peer reflexive candidate. |
1483 const StunAddressAttribute* addr = | 1491 const StunAddressAttribute* addr = |
1484 response->GetAddress(STUN_ATTR_XOR_MAPPED_ADDRESS); | 1492 response->GetAddress(STUN_ATTR_XOR_MAPPED_ADDRESS); |
1485 if (!addr) { | 1493 if (!addr) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1556 ASSERT(sent < 0); | 1564 ASSERT(sent < 0); |
1557 error_ = port_->GetError(); | 1565 error_ = port_->GetError(); |
1558 sent_packets_discarded_++; | 1566 sent_packets_discarded_++; |
1559 } else { | 1567 } else { |
1560 send_rate_tracker_.Update(sent); | 1568 send_rate_tracker_.Update(sent); |
1561 } | 1569 } |
1562 return sent; | 1570 return sent; |
1563 } | 1571 } |
1564 | 1572 |
1565 } // namespace cricket | 1573 } // namespace cricket |
OLD | NEW |