Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: webrtc/p2p/base/fakeportallocator.h

Issue 2171183002: Remove ports that are not used by any channel after timeout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698