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

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: . 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
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
146 void set_pruned() { state_ = STATE_PRUNED; } 145 void set_pruned() { state_ = STATE_PRUNED; }
skvlad 2016/09/14 02:35:11 This doesn't seem to be called from anywhere else.
honghaiz3 2016/09/14 16:50:31 Done.
146 // Sets the state to "PRUNED" and prunes the Port.
147 void PrunePort() {
148 set_pruned();
149 if (port()) {
150 port()->Prune();
151 }
152 }
147 void set_has_pairable_candidate(bool has_pairable_candidate) { 153 void set_has_pairable_candidate(bool has_pairable_candidate) {
148 if (has_pairable_candidate) { 154 if (has_pairable_candidate) {
149 ASSERT(state_ == STATE_INPROGRESS); 155 ASSERT(state_ == STATE_INPROGRESS);
150 } 156 }
151 has_pairable_candidate_ = has_pairable_candidate; 157 has_pairable_candidate_ = has_pairable_candidate;
152 } 158 }
153 void set_complete() { 159 void set_complete() {
154 state_ = STATE_COMPLETE; 160 state_ = STATE_COMPLETE;
155 } 161 }
156 void set_error() { 162 void set_error() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 PortData* FindPort(Port* port); 200 PortData* FindPort(Port* port);
195 std::vector<rtc::Network*> GetNetworks(); 201 std::vector<rtc::Network*> GetNetworks();
196 std::vector<rtc::Network*> GetFailedNetworks(); 202 std::vector<rtc::Network*> GetFailedNetworks();
197 203
198 bool CheckCandidateFilter(const Candidate& c) const; 204 bool CheckCandidateFilter(const Candidate& c) const;
199 bool CandidatePairable(const Candidate& c, const Port* port) const; 205 bool CandidatePairable(const Candidate& c, const Port* port) const;
200 // Clear the related address according to the flags and candidate filter 206 // Clear the related address according to the flags and candidate filter
201 // in order to avoid leaking any information. 207 // in order to avoid leaking any information.
202 Candidate SanitizeRelatedAddress(const Candidate& c) const; 208 Candidate SanitizeRelatedAddress(const Candidate& c) const;
203 209
204 // Removes the ports and candidates on given networks. 210 std::vector<PortData*> GetUnprunedPortsOnNetworks(
205 void RemovePortsAndCandidates(const std::vector<rtc::Network*>& networks); 211 const std::vector<rtc::Network*>& networks);
212 // Prunes ports and signal the remote side to remove the candidates generated
213 // by these ports.
214 void PrunePortsAndRemoveCandidates(
215 const std::vector<PortData*>& port_data_list);
206 // Gets filtered and sanitized candidates generated from a port and 216 // Gets filtered and sanitized candidates generated from a port and
207 // append to |candidates|. 217 // append to |candidates|.
208 void GetCandidatesFromPort(const PortData& data, 218 void GetCandidatesFromPort(const PortData& data,
209 std::vector<Candidate>* candidates) const; 219 std::vector<Candidate>* candidates) const;
210 Port* GetBestTurnPortForNetwork(const std::string& network_name) const; 220 Port* GetBestTurnPortForNetwork(const std::string& network_name) const;
211 // Returns true if at least one TURN port is pruned. 221 // Returns true if at least one TURN port is pruned.
212 bool PruneTurnPorts(Port* newly_pairable_turn_port); 222 bool PruneTurnPorts(Port* newly_pairable_turn_port);
213 223
214 BasicPortAllocator* allocator_; 224 BasicPortAllocator* allocator_;
215 rtc::Thread* network_thread_; 225 rtc::Thread* network_thread_;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_; 366 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_;
357 // There will be only one udp port per AllocationSequence. 367 // There will be only one udp port per AllocationSequence.
358 UDPPort* udp_port_; 368 UDPPort* udp_port_;
359 std::vector<TurnPort*> turn_ports_; 369 std::vector<TurnPort*> turn_ports_;
360 int phase_; 370 int phase_;
361 }; 371 };
362 372
363 } // namespace cricket 373 } // namespace cricket
364 374
365 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ 375 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698