Chromium Code Reviews| Index: webrtc/p2p/client/basicportallocator.h |
| diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h |
| index c66ae596c8a282400d7c0078fba33c84dcb584cb..0a3490ee7477d6b4d2a9504de5a894cd1c2ce900 100644 |
| --- a/webrtc/p2p/client/basicportallocator.h |
| +++ b/webrtc/p2p/client/basicportallocator.h |
| @@ -38,13 +38,6 @@ class BasicPortAllocator : public PortAllocator { |
| const rtc::SocketAddress& relay_server_ssl); |
| virtual ~BasicPortAllocator(); |
| - void SetIceServers( |
| - const ServerAddresses& stun_servers, |
| - const std::vector<RelayServerConfig>& turn_servers) override { |
| - stun_servers_ = stun_servers; |
| - turn_servers_ = turn_servers; |
| - } |
| - |
| // Set to kDefaultNetworkIgnoreMask by default. |
| void SetNetworkIgnoreMask(int network_ignore_mask) override { |
| // TODO(phoglund): implement support for other types than loopback. |
| @@ -61,30 +54,20 @@ class BasicPortAllocator : public PortAllocator { |
| // creates its own socket factory. |
| rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } |
| - const ServerAddresses& stun_servers() const { |
| - return stun_servers_; |
| - } |
| - |
| - const std::vector<RelayServerConfig>& turn_servers() const { |
| - return turn_servers_; |
| - } |
| - virtual void AddTurnServer(const RelayServerConfig& turn_server) { |
| - turn_servers_.push_back(turn_server); |
| - } |
| - |
| PortAllocatorSession* CreateSessionInternal( |
| const std::string& content_name, |
| int component, |
| const std::string& ice_ufrag, |
| const std::string& ice_pwd) override; |
| + // Convenience method that adds a TURN server to the configuration. |
| + void AddTurnServer(const RelayServerConfig& turn_server); |
| + |
| private: |
| void Construct(); |
| rtc::NetworkManager* network_manager_; |
| rtc::PacketSocketFactory* socket_factory_; |
| - ServerAddresses stun_servers_; |
| - std::vector<RelayServerConfig> turn_servers_; |
| bool allow_tcp_listen_; |
| int network_ignore_mask_ = rtc::kDefaultNetworkIgnoreMask; |
| }; |
| @@ -110,8 +93,14 @@ class BasicPortAllocatorSession : public PortAllocatorSession, |
| void StopGettingPorts() override; |
| void ClearGettingPorts() override; |
| bool IsGettingPorts() override { return running_; } |
| + // These will all be cricket::Ports. |
| + std::vector<PortInterface*> ReadyPorts() const override; |
| + std::vector<Candidate> ReadyCandidates() const override; |
| + bool CandidatesAllocationDone() const override; |
| protected: |
| + void UpdateTransportInformationInternal() override; |
| + |
| // Starts the process of getting the port configurations. |
| virtual void GetPortConfigurations(); |
| @@ -130,11 +119,14 @@ class BasicPortAllocatorSession : public PortAllocatorSession, |
| : port_(port), sequence_(seq), state_(STATE_INIT) { |
| } |
| - Port* port() { return port_; } |
| - AllocationSequence* sequence() { return sequence_; } |
| + Port* port() const { return port_; } |
| + AllocationSequence* sequence() const { return sequence_; } |
| bool ready() const { return state_ == STATE_READY; } |
| - bool complete() const { |
| - // Returns true if candidate allocation has completed one way or another. |
| + bool ready_or_complete() const { |
| + return ((state_ == STATE_READY) || (state_ == STATE_COMPLETE)); |
| + } |
|
pthatcher1
2016/05/05 21:51:25
Why not just have complete() and then let callers
Taylor Brandstetter
2016/05/06 03:53:35
I was just keeping it the way it was before. I ass
|
| + // Returns true if candidate allocation has completed one way or another. |
| + bool complete_or_error() const { |
| return ((state_ == STATE_COMPLETE) || (state_ == STATE_ERROR)); |
| } |
|
pthatcher1
2016/05/05 21:51:25
Same here: "complete() || error()"
Taylor Brandstetter
2016/05/06 03:53:35
Done.
|
| @@ -182,7 +174,7 @@ class BasicPortAllocatorSession : public PortAllocatorSession, |
| PortData* FindPort(Port* port); |
| void GetNetworks(std::vector<rtc::Network*>* networks); |
| - bool CheckCandidateFilter(const Candidate& c); |
| + bool CheckCandidateFilter(const Candidate& c) const; |
| BasicPortAllocator* allocator_; |
| rtc::Thread* network_thread_; |