 Chromium Code Reviews
 Chromium Code Reviews Issue 2083803002:
  Fix IPv6 support issue.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master
    
  
    Issue 2083803002:
  Fix IPv6 support issue.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 server_address_.address.SetPort(TURN_DEFAULT_PORT); | 284 server_address_.address.SetPort(TURN_DEFAULT_PORT); | 
| 285 } | 285 } | 
| 286 | 286 | 
| 287 if (server_address_.address.IsUnresolvedIP()) { | 287 if (server_address_.address.IsUnresolvedIP()) { | 
| 288 ResolveTurnAddress(server_address_.address); | 288 ResolveTurnAddress(server_address_.address); | 
| 289 } else { | 289 } else { | 
| 290 // If protocol family of server address doesn't match with local, return. | 290 // If protocol family of server address doesn't match with local, return. | 
| 291 if (!IsCompatibleAddress(server_address_.address)) { | 291 if (!IsCompatibleAddress(server_address_.address)) { | 
| 292 LOG(LS_ERROR) << "IP address family does not match: " | 292 LOG(LS_ERROR) << "IP address family does not match: " | 
| 293 << "server: " << server_address_.address.family() | 293 << "server: " << server_address_.address.family() | 
| 294 << "local: " << ip().family(); | 294 << " local: " << ip().family(); | 
| 295 OnAllocateError(); | 295 OnAllocateError(); | 
| 296 return; | 296 return; | 
| 297 } | 297 } | 
| 298 | 298 | 
| 299 // Insert the current address to prevent redirection pingpong. | 299 // Insert the current address to prevent redirection pingpong. | 
| 300 attempted_server_addresses_.insert(server_address_.address); | 300 attempted_server_addresses_.insert(server_address_.address); | 
| 301 | 301 | 
| 302 LOG_J(LS_INFO, this) << "Trying to connect to TURN server via " | 302 LOG_J(LS_INFO, this) << "Trying to connect to TURN server via " | 
| 303 << ProtoToString(server_address_.proto) << " @ " | 303 << ProtoToString(server_address_.proto) << " @ " | 
| 304 << server_address_.address.ToSensitiveString(); | 304 << server_address_.address.ToSensitiveString(); | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 } else { | 431 } else { | 
| 432 delete socket_; | 432 delete socket_; | 
| 433 } | 433 } | 
| 434 socket_ = NULL; | 434 socket_ = NULL; | 
| 435 | 435 | 
| 436 ResetNonce(); | 436 ResetNonce(); | 
| 437 PrepareAddress(); | 437 PrepareAddress(); | 
| 438 ++allocate_mismatch_retries_; | 438 ++allocate_mismatch_retries_; | 
| 439 } | 439 } | 
| 440 | 440 | 
| 441 Connection* TurnPort::CreateConnection(const Candidate& address, | 441 Connection* TurnPort::CreateConnection(const Candidate& remote_candidate, | 
| 442 CandidateOrigin origin) { | 442 CandidateOrigin origin) { | 
| 443 // TURN-UDP can only connect to UDP candidates. | 443 // TURN-UDP can only connect to UDP candidates. | 
| 444 if (!SupportsProtocol(address.protocol())) { | 444 if (!SupportsProtocol(remote_candidate.protocol())) { | 
| 445 return NULL; | 445 return NULL; | 
| 446 } | 446 } | 
| 447 | 447 | 
| 448 if (!IsCompatibleAddress(address.address())) { | |
| 449 return NULL; | |
| 450 } | |
| 451 | |
| 452 if (state_ == STATE_DISCONNECTED || state_ == STATE_RECEIVEONLY) { | 448 if (state_ == STATE_DISCONNECTED || state_ == STATE_RECEIVEONLY) { | 
| 453 return NULL; | 449 return NULL; | 
| 454 } | 450 } | 
| 455 | 451 | 
| 456 // Create an entry, if needed, so we can get our permissions set up correctly. | |
| 457 CreateOrRefreshEntry(address.address()); | |
| 458 | |
| 459 // A TURN port will have two candiates, STUN and TURN. STUN may not | 452 // A TURN port will have two candiates, STUN and TURN. STUN may not | 
| 
juberti
2016/06/23 14:51:18
Is this still the case? I was under the impression
 
Taylor Brandstetter
2016/06/23 17:09:53
You may be right. I think even if using a TURN ser
 
honghaiz3
2016/06/23 17:17:04
Agree. I think the TURN port is not collecting STU
 | |
| 460 // present in all cases. If present stun candidate will be added first | 453 // present in all cases. If present stun candidate will be added first | 
| 461 // and TURN candidate later. | 454 // and TURN candidate later. | 
| 462 for (size_t index = 0; index < Candidates().size(); ++index) { | 455 for (size_t index = 0; index < Candidates().size(); ++index) { | 
| 463 if (Candidates()[index].type() == RELAY_PORT_TYPE) { | 456 const Candidate& local_candidate = Candidates()[index]; | 
| 464 ProxyConnection* conn = new ProxyConnection(this, index, address); | 457 if (local_candidate.type() == RELAY_PORT_TYPE && | 
| 458 local_candidate.address().family() == | |
| 459 remote_candidate.address().family()) { | |
| 460 // Create an entry, if needed, so we can get our permissions set up | |
| 461 // correctly. | |
| 462 CreateOrRefreshEntry(remote_candidate.address()); | |
| 463 ProxyConnection* conn = | |
| 464 new ProxyConnection(this, index, remote_candidate); | |
| 465 AddOrReplaceConnection(conn); | 465 AddOrReplaceConnection(conn); | 
| 466 return conn; | 466 return conn; | 
| 467 } | 467 } | 
| 468 } | 468 } | 
| 469 return NULL; | 469 return NULL; | 
| 470 } | 470 } | 
| 471 | 471 | 
| 472 bool TurnPort::FailAndPruneConnection(const rtc::SocketAddress& address) { | 472 bool TurnPort::FailAndPruneConnection(const rtc::SocketAddress& address) { | 
| 473 Connection* conn = GetConnection(address); | 473 Connection* conn = GetConnection(address); | 
| 474 if (conn != nullptr) { | 474 if (conn != nullptr) { | 
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1533 } else { | 1533 } else { | 
| 1534 state_ = STATE_UNBOUND; | 1534 state_ = STATE_UNBOUND; | 
| 1535 port_->FailAndPruneConnection(ext_addr_); | 1535 port_->FailAndPruneConnection(ext_addr_); | 
| 1536 } | 1536 } | 
| 1537 } | 1537 } | 
| 1538 void TurnEntry::OnChannelBindTimeout() { | 1538 void TurnEntry::OnChannelBindTimeout() { | 
| 1539 state_ = STATE_UNBOUND; | 1539 state_ = STATE_UNBOUND; | 
| 1540 port_->FailAndPruneConnection(ext_addr_); | 1540 port_->FailAndPruneConnection(ext_addr_); | 
| 1541 } | 1541 } | 
| 1542 } // namespace cricket | 1542 } // namespace cricket | 
| OLD | NEW |