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

Side by Side Diff: webrtc/p2p/client/basicportallocator.h

Issue 2261523004: Signal to remove remote candidates if ports are pruned. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Merge to head and fix a comment Created 4 years, 3 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 | « webrtc/base/virtualsocketserver.cc ('k') | webrtc/p2p/client/basicportallocator.cc » ('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 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool has_pairable_candidate() const { return has_pairable_candidate_; } 135 bool has_pairable_candidate() const { return has_pairable_candidate_; }
136 bool complete() const { return state_ == STATE_COMPLETE; } 136 bool complete() const { return state_ == STATE_COMPLETE; }
137 bool error() const { return state_ == STATE_ERROR; } 137 bool error() const { return state_ == STATE_ERROR; }
138 bool pruned() const { return state_ == STATE_PRUNED; } 138 bool pruned() const { return state_ == STATE_PRUNED; }
139 bool inprogress() const { return state_ == STATE_INPROGRESS; } 139 bool inprogress() const { return state_ == STATE_INPROGRESS; }
140 // Returns true if this port is ready to be used. 140 // Returns true if this port is ready to be used.
141 bool ready() const { 141 bool ready() const {
142 return has_pairable_candidate_ && state_ != STATE_ERROR && 142 return has_pairable_candidate_ && state_ != STATE_ERROR &&
143 state_ != STATE_PRUNED; 143 state_ != STATE_PRUNED;
144 } 144 }
145 145 // Sets the state to "PRUNED" and prunes the Port.
146 void set_pruned() { state_ = STATE_PRUNED; } 146 void Prune() {
147 state_ = STATE_PRUNED;
148 if (port()) {
149 port()->Prune();
150 }
151 }
147 void set_has_pairable_candidate(bool has_pairable_candidate) { 152 void set_has_pairable_candidate(bool has_pairable_candidate) {
148 if (has_pairable_candidate) { 153 if (has_pairable_candidate) {
149 ASSERT(state_ == STATE_INPROGRESS); 154 ASSERT(state_ == STATE_INPROGRESS);
150 } 155 }
151 has_pairable_candidate_ = has_pairable_candidate; 156 has_pairable_candidate_ = has_pairable_candidate;
152 } 157 }
153 void set_complete() { 158 void set_complete() {
154 state_ = STATE_COMPLETE; 159 state_ = STATE_COMPLETE;
155 } 160 }
156 void set_error() { 161 void set_error() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 PortData* FindPort(Port* port); 199 PortData* FindPort(Port* port);
195 std::vector<rtc::Network*> GetNetworks(); 200 std::vector<rtc::Network*> GetNetworks();
196 std::vector<rtc::Network*> GetFailedNetworks(); 201 std::vector<rtc::Network*> GetFailedNetworks();
197 202
198 bool CheckCandidateFilter(const Candidate& c) const; 203 bool CheckCandidateFilter(const Candidate& c) const;
199 bool CandidatePairable(const Candidate& c, const Port* port) const; 204 bool CandidatePairable(const Candidate& c, const Port* port) const;
200 // Clear the related address according to the flags and candidate filter 205 // Clear the related address according to the flags and candidate filter
201 // in order to avoid leaking any information. 206 // in order to avoid leaking any information.
202 Candidate SanitizeRelatedAddress(const Candidate& c) const; 207 Candidate SanitizeRelatedAddress(const Candidate& c) const;
203 208
204 // Removes the ports and candidates on given networks. 209 std::vector<PortData*> GetUnprunedPorts(
205 void RemovePortsAndCandidates(const std::vector<rtc::Network*>& networks); 210 const std::vector<rtc::Network*>& networks);
211 // Prunes ports and signal the remote side to remove the candidates that
212 // were previously signaled from these ports.
213 void PrunePortsAndRemoveCandidates(
214 const std::vector<PortData*>& port_data_list);
206 // Gets filtered and sanitized candidates generated from a port and 215 // Gets filtered and sanitized candidates generated from a port and
207 // append to |candidates|. 216 // append to |candidates|.
208 void GetCandidatesFromPort(const PortData& data, 217 void GetCandidatesFromPort(const PortData& data,
209 std::vector<Candidate>* candidates) const; 218 std::vector<Candidate>* candidates) const;
210 Port* GetBestTurnPortForNetwork(const std::string& network_name) const; 219 Port* GetBestTurnPortForNetwork(const std::string& network_name) const;
211 // Returns true if at least one TURN port is pruned. 220 // Returns true if at least one TURN port is pruned.
212 bool PruneTurnPorts(Port* newly_pairable_turn_port); 221 bool PruneTurnPorts(Port* newly_pairable_turn_port);
213 222
214 BasicPortAllocator* allocator_; 223 BasicPortAllocator* allocator_;
215 rtc::Thread* network_thread_; 224 rtc::Thread* network_thread_;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_; 365 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_;
357 // There will be only one udp port per AllocationSequence. 366 // There will be only one udp port per AllocationSequence.
358 UDPPort* udp_port_; 367 UDPPort* udp_port_;
359 std::vector<TurnPort*> turn_ports_; 368 std::vector<TurnPort*> turn_ports_;
360 int phase_; 369 int phase_;
361 }; 370 };
362 371
363 } // namespace cricket 372 } // namespace cricket
364 373
365 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ 374 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
OLDNEW
« no previous file with comments | « webrtc/base/virtualsocketserver.cc ('k') | webrtc/p2p/client/basicportallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698