| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   448     break; |   448     break; | 
|   449   case MSG_SEQUENCEOBJECTS_CREATED: |   449   case MSG_SEQUENCEOBJECTS_CREATED: | 
|   450     ASSERT(rtc::Thread::Current() == network_thread_); |   450     ASSERT(rtc::Thread::Current() == network_thread_); | 
|   451     OnAllocationSequenceObjectsCreated(); |   451     OnAllocationSequenceObjectsCreated(); | 
|   452     break; |   452     break; | 
|   453   case MSG_CONFIG_STOP: |   453   case MSG_CONFIG_STOP: | 
|   454     ASSERT(rtc::Thread::Current() == network_thread_); |   454     ASSERT(rtc::Thread::Current() == network_thread_); | 
|   455     OnConfigStop(); |   455     OnConfigStop(); | 
|   456     break; |   456     break; | 
|   457   default: |   457   default: | 
|   458     ASSERT(false); |   458     RTC_NOTREACHED(); | 
|   459   } |   459   } | 
|   460 } |   460 } | 
|   461  |   461  | 
|   462 void BasicPortAllocatorSession::UpdateIceParametersInternal() { |   462 void BasicPortAllocatorSession::UpdateIceParametersInternal() { | 
|   463   for (PortData& port : ports_) { |   463   for (PortData& port : ports_) { | 
|   464     port.port()->set_content_name(content_name()); |   464     port.port()->set_content_name(content_name()); | 
|   465     port.port()->SetIceParameters(component(), ice_ufrag(), ice_pwd()); |   465     port.port()->SetIceParameters(component(), ice_ufrag(), ice_pwd()); | 
|   466   } |   466   } | 
|   467 } |   467 } | 
|   468  |   468  | 
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   968   ASSERT(rtc::Thread::Current() == network_thread_); |   968   ASSERT(rtc::Thread::Current() == network_thread_); | 
|   969   for (std::vector<PortData>::iterator iter = ports_.begin(); |   969   for (std::vector<PortData>::iterator iter = ports_.begin(); | 
|   970        iter != ports_.end(); ++iter) { |   970        iter != ports_.end(); ++iter) { | 
|   971     if (port == iter->port()) { |   971     if (port == iter->port()) { | 
|   972       ports_.erase(iter); |   972       ports_.erase(iter); | 
|   973       LOG_J(LS_INFO, port) << "Removed port from allocator (" |   973       LOG_J(LS_INFO, port) << "Removed port from allocator (" | 
|   974                            << static_cast<int>(ports_.size()) << " remaining)"; |   974                            << static_cast<int>(ports_.size()) << " remaining)"; | 
|   975       return; |   975       return; | 
|   976     } |   976     } | 
|   977   } |   977   } | 
|   978   ASSERT(false); |   978   RTC_NOTREACHED(); | 
|   979 } |   979 } | 
|   980  |   980  | 
|   981 BasicPortAllocatorSession::PortData* BasicPortAllocatorSession::FindPort( |   981 BasicPortAllocatorSession::PortData* BasicPortAllocatorSession::FindPort( | 
|   982     Port* port) { |   982     Port* port) { | 
|   983   for (std::vector<PortData>::iterator it = ports_.begin(); |   983   for (std::vector<PortData>::iterator it = ports_.begin(); | 
|   984        it != ports_.end(); ++it) { |   984        it != ports_.end(); ++it) { | 
|   985     if (it->port() == port) { |   985     if (it->port() == port) { | 
|   986       return &*it; |   986       return &*it; | 
|   987     } |   987     } | 
|   988   } |   988   } | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1149       CreateTCPPorts(); |  1149       CreateTCPPorts(); | 
|  1150       EnableProtocol(PROTO_TCP); |  1150       EnableProtocol(PROTO_TCP); | 
|  1151       break; |  1151       break; | 
|  1152  |  1152  | 
|  1153     case PHASE_SSLTCP: |  1153     case PHASE_SSLTCP: | 
|  1154       state_ = kCompleted; |  1154       state_ = kCompleted; | 
|  1155       EnableProtocol(PROTO_SSLTCP); |  1155       EnableProtocol(PROTO_SSLTCP); | 
|  1156       break; |  1156       break; | 
|  1157  |  1157  | 
|  1158     default: |  1158     default: | 
|  1159       ASSERT(false); |  1159       RTC_NOTREACHED(); | 
|  1160   } |  1160   } | 
|  1161  |  1161  | 
|  1162   if (state() == kRunning) { |  1162   if (state() == kRunning) { | 
|  1163     ++phase_; |  1163     ++phase_; | 
|  1164     session_->network_thread()->PostDelayed(RTC_FROM_HERE, |  1164     session_->network_thread()->PostDelayed(RTC_FROM_HERE, | 
|  1165                                             session_->allocator()->step_delay(), |  1165                                             session_->allocator()->step_delay(), | 
|  1166                                             this, MSG_ALLOCATION_PHASE); |  1166                                             this, MSG_ALLOCATION_PHASE); | 
|  1167   } else { |  1167   } else { | 
|  1168     // If all phases in AllocationSequence are completed, no allocation |  1168     // If all phases in AllocationSequence are completed, no allocation | 
|  1169     // steps needed further. Canceling  pending signal. |  1169     // steps needed further. Canceling  pending signal. | 
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1298         << "AllocationSequence: No relay server configured, skipping."; |  1298         << "AllocationSequence: No relay server configured, skipping."; | 
|  1299     return; |  1299     return; | 
|  1300   } |  1300   } | 
|  1301  |  1301  | 
|  1302   for (RelayServerConfig& relay : config_->relays) { |  1302   for (RelayServerConfig& relay : config_->relays) { | 
|  1303     if (relay.type == RELAY_GTURN) { |  1303     if (relay.type == RELAY_GTURN) { | 
|  1304       CreateGturnPort(relay); |  1304       CreateGturnPort(relay); | 
|  1305     } else if (relay.type == RELAY_TURN) { |  1305     } else if (relay.type == RELAY_TURN) { | 
|  1306       CreateTurnPort(relay); |  1306       CreateTurnPort(relay); | 
|  1307     } else { |  1307     } else { | 
|  1308       ASSERT(false); |  1308       RTC_NOTREACHED(); | 
|  1309     } |  1309     } | 
|  1310   } |  1310   } | 
|  1311 } |  1311 } | 
|  1312  |  1312  | 
|  1313 void AllocationSequence::CreateGturnPort(const RelayServerConfig& config) { |  1313 void AllocationSequence::CreateGturnPort(const RelayServerConfig& config) { | 
|  1314   // TODO(mallinath) - Rename RelayPort to GTurnPort. |  1314   // TODO(mallinath) - Rename RelayPort to GTurnPort. | 
|  1315   RelayPort* port = RelayPort::Create(session_->network_thread(), |  1315   RelayPort* port = RelayPort::Create(session_->network_thread(), | 
|  1316                                       session_->socket_factory(), |  1316                                       session_->socket_factory(), | 
|  1317                                       network_, ip_, |  1317                                       network_, ip_, | 
|  1318                                       session_->allocator()->min_port(), |  1318                                       session_->allocator()->min_port(), | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1441   if (udp_port_ == port) { |  1441   if (udp_port_ == port) { | 
|  1442     udp_port_ = NULL; |  1442     udp_port_ = NULL; | 
|  1443     return; |  1443     return; | 
|  1444   } |  1444   } | 
|  1445  |  1445  | 
|  1446   auto it = std::find(turn_ports_.begin(), turn_ports_.end(), port); |  1446   auto it = std::find(turn_ports_.begin(), turn_ports_.end(), port); | 
|  1447   if (it != turn_ports_.end()) { |  1447   if (it != turn_ports_.end()) { | 
|  1448     turn_ports_.erase(it); |  1448     turn_ports_.erase(it); | 
|  1449   } else { |  1449   } else { | 
|  1450     LOG(LS_ERROR) << "Unexpected OnPortDestroyed for nonexistent port."; |  1450     LOG(LS_ERROR) << "Unexpected OnPortDestroyed for nonexistent port."; | 
|  1451     ASSERT(false); |  1451     RTC_NOTREACHED(); | 
|  1452   } |  1452   } | 
|  1453 } |  1453 } | 
|  1454  |  1454  | 
|  1455 // PortConfiguration |  1455 // PortConfiguration | 
|  1456 PortConfiguration::PortConfiguration( |  1456 PortConfiguration::PortConfiguration( | 
|  1457     const rtc::SocketAddress& stun_address, |  1457     const rtc::SocketAddress& stun_address, | 
|  1458     const std::string& username, |  1458     const std::string& username, | 
|  1459     const std::string& password) |  1459     const std::string& password) | 
|  1460     : stun_address(stun_address), username(username), password(password) { |  1460     : stun_address(stun_address), username(username), password(password) { | 
|  1461   if (!stun_address.IsNil()) |  1461   if (!stun_address.IsNil()) | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1518   ServerAddresses servers; |  1518   ServerAddresses servers; | 
|  1519   for (size_t i = 0; i < relays.size(); ++i) { |  1519   for (size_t i = 0; i < relays.size(); ++i) { | 
|  1520     if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { |  1520     if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { | 
|  1521       servers.insert(relays[i].ports.front().address); |  1521       servers.insert(relays[i].ports.front().address); | 
|  1522     } |  1522     } | 
|  1523   } |  1523   } | 
|  1524   return servers; |  1524   return servers; | 
|  1525 } |  1525 } | 
|  1526  |  1526  | 
|  1527 }  // namespace cricket |  1527 }  // namespace cricket | 
| OLD | NEW |