| Index: webrtc/p2p/client/basicportallocator.h
|
| diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h
|
| index 8ea66c431e76d560a6299c2831d77a1a83dfeb06..3e5a577a6b007d2d295cdbcbe4786ce1fcd2c88a 100644
|
| --- a/webrtc/p2p/client/basicportallocator.h
|
| +++ b/webrtc/p2p/client/basicportallocator.h
|
| @@ -123,7 +123,15 @@ 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; }
|
| + bool inprogress() const { return state_ == STATE_INPROGRESS; }
|
| + // Returns true if this port is ready to be used.
|
| + bool ready() const {
|
| + return has_pairable_candidate_ && state_ != STATE_ERROR &&
|
| + state_ != STATE_PRUNED;
|
| + }
|
|
|
| + 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 +150,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 +173,7 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
|
| void AddAllocatedPort(Port* port, AllocationSequence* seq,
|
| bool prepare_address);
|
| void OnCandidateReady(Port* port, const Candidate& c);
|
| + bool IsPortInUse(const PortData& data) const;
|
| void OnPortComplete(Port* port);
|
| void OnPortError(Port* port);
|
| void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto);
|
| @@ -178,6 +189,10 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
|
| // in order to avoid leaking any information.
|
| Candidate SanitizeRelatedAddress(const Candidate& c) const;
|
|
|
| + Port* GetBestTurnPortForNetwork(const std::string& network_name) const;
|
| + // Returns true if at least one TURN port is pruned.
|
| + bool PruneTurnPorts(Port* newly_pairable_turn_port);
|
| +
|
| BasicPortAllocator* allocator_;
|
| rtc::Thread* network_thread_;
|
| std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
|
|
|