| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void StopGettingPorts() override { running_ = false; } | 142 void StopGettingPorts() override { running_ = false; } |
| 143 bool IsGettingPorts() override { return running_; } | 143 bool IsGettingPorts() override { return running_; } |
| 144 void ClearGettingPorts() override {} | 144 void ClearGettingPorts() override {} |
| 145 | 145 |
| 146 std::vector<PortInterface*> ReadyPorts() const override { | 146 std::vector<PortInterface*> ReadyPorts() const override { |
| 147 return ready_ports_; | 147 return ready_ports_; |
| 148 } | 148 } |
| 149 std::vector<Candidate> ReadyCandidates() const override { | 149 std::vector<Candidate> ReadyCandidates() const override { |
| 150 return candidates_; | 150 return candidates_; |
| 151 } | 151 } |
| 152 void PruneAllPorts() override { port_->Prune(); } |
| 152 bool CandidatesAllocationDone() const override { return allocation_done_; } | 153 bool CandidatesAllocationDone() const override { return allocation_done_; } |
| 153 | 154 |
| 154 int port_config_count() { return port_config_count_; } | 155 int port_config_count() { return port_config_count_; } |
| 155 | 156 |
| 156 const ServerAddresses& stun_servers() const { return stun_servers_; } | 157 const ServerAddresses& stun_servers() const { return stun_servers_; } |
| 157 | 158 |
| 158 const std::vector<RelayServerConfig>& turn_servers() const { | 159 const std::vector<RelayServerConfig>& turn_servers() const { |
| 159 return turn_servers_; | 160 return turn_servers_; |
| 160 } | 161 } |
| 161 | 162 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 174 | 175 |
| 175 private: | 176 private: |
| 176 void AddPort(cricket::Port* port) { | 177 void AddPort(cricket::Port* port) { |
| 177 port->set_component(component()); | 178 port->set_component(component()); |
| 178 port->set_generation(generation()); | 179 port->set_generation(generation()); |
| 179 port->SignalPortComplete.connect(this, | 180 port->SignalPortComplete.connect(this, |
| 180 &FakePortAllocatorSession::OnPortComplete); | 181 &FakePortAllocatorSession::OnPortComplete); |
| 181 port->PrepareAddress(); | 182 port->PrepareAddress(); |
| 182 ready_ports_.push_back(port); | 183 ready_ports_.push_back(port); |
| 183 SignalPortReady(this, port); | 184 SignalPortReady(this, port); |
| 185 port->KeepAliveUntilPruned(); |
| 184 } | 186 } |
| 185 void OnPortComplete(cricket::Port* port) { | 187 void OnPortComplete(cricket::Port* port) { |
| 186 const std::vector<Candidate>& candidates = port->Candidates(); | 188 const std::vector<Candidate>& candidates = port->Candidates(); |
| 187 candidates_.insert(candidates_.end(), candidates.begin(), candidates.end()); | 189 candidates_.insert(candidates_.end(), candidates.begin(), candidates.end()); |
| 188 SignalCandidatesReady(this, candidates); | 190 SignalCandidatesReady(this, candidates); |
| 189 | 191 |
| 190 allocation_done_ = true; | 192 allocation_done_ = true; |
| 191 SignalCandidatesAllocationDone(this); | 193 SignalCandidatesAllocationDone(this); |
| 192 } | 194 } |
| 193 void OnPortDestroyed(cricket::PortInterface* port) { | 195 void OnPortDestroyed(cricket::PortInterface* port) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 private: | 247 private: |
| 246 rtc::Thread* network_thread_; | 248 rtc::Thread* network_thread_; |
| 247 rtc::PacketSocketFactory* factory_; | 249 rtc::PacketSocketFactory* factory_; |
| 248 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; | 250 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; |
| 249 bool initialized_ = false; | 251 bool initialized_ = false; |
| 250 }; | 252 }; |
| 251 | 253 |
| 252 } // namespace cricket | 254 } // namespace cricket |
| 253 | 255 |
| 254 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ | 256 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ |
| OLD | NEW |