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

Unified Diff: webrtc/p2p/client/basicportallocator.h

Issue 2093623004: Add config to prune TURN ports (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge branch 'master' into turn_port_exposer Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/client/basicportallocator.h
diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h
index 8ea66c431e76d560a6299c2831d77a1a83dfeb06..d273c606033ba887e74a1e707aae91d8b2bb0b79 100644
--- a/webrtc/p2p/client/basicportallocator.h
+++ b/webrtc/p2p/client/basicportallocator.h
@@ -123,7 +123,11 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
bool has_pairable_candidate() const { return has_pairable_candidate_; }
bool complete() const { return state_ == STATE_COMPLETE; }
bool error() const { return state_ == STATE_ERROR; }
+ bool pruned() const { return state_ == STATE_PRUNED; }
+ // A terminated state is one of COMPLETE, ERROR or PRUNED state.
+ bool terminated() const { return state_ != STATE_INPROGRESS; }
pthatcher1 2016/06/28 21:01:41 Why not have bool gathering() cosnt { return state
honghaiz3 2016/06/28 23:36:00 Done. I used the name inprogress to match the vari
+ void set_pruned() { state_ = STATE_PRUNED; }
void set_has_pairable_candidate(bool has_pairable_candidate) {
if (has_pairable_candidate) {
ASSERT(state_ == STATE_INPROGRESS);
@@ -142,7 +146,9 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
enum State {
STATE_INPROGRESS, // Still gathering candidates.
STATE_COMPLETE, // All candidates allocated and ready for process.
- STATE_ERROR // Error in gathering candidates.
+ STATE_ERROR, // Error in gathering candidates.
+ STATE_PRUNED // Pruned by higher priority ports on the same network
+ // interface. Only TURN ports may be pruned.
};
Port* port_ = nullptr;
AllocationSequence* sequence_ = nullptr;
@@ -163,6 +169,8 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
void AddAllocatedPort(Port* port, AllocationSequence* seq,
bool prepare_address);
void OnCandidateReady(Port* port, const Candidate& c);
+ void OnPortPairable(PortData* port_data);
+ bool IsPortInUse(const PortData& data) const;
void OnPortComplete(Port* port);
void OnPortError(Port* port);
void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto);

Powered by Google App Engine
This is Rietveld 408576698