| Index: webrtc/p2p/client/basicportallocator.h
|
| diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h
|
| index ec1fcb54f8747f41645e80dadec077faec6cd401..c66ae596c8a282400d7c0078fba33c84dcb584cb 100644
|
| --- a/webrtc/p2p/client/basicportallocator.h
|
| +++ b/webrtc/p2p/client/basicportallocator.h
|
| @@ -38,6 +38,13 @@ 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.
|
| @@ -54,20 +61,30 @@ 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;
|
| };
|
| @@ -93,14 +110,8 @@ 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 UpdateIceParametersInternal() override;
|
| -
|
| // Starts the process of getting the port configurations.
|
| virtual void GetPortConfigurations();
|
|
|
| @@ -119,11 +130,13 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
|
| : port_(port), sequence_(seq), state_(STATE_INIT) {
|
| }
|
|
|
| - Port* port() const { return port_; }
|
| - AllocationSequence* sequence() const { return sequence_; }
|
| + Port* port() { return port_; }
|
| + AllocationSequence* sequence() { return sequence_; }
|
| bool ready() const { return state_ == STATE_READY; }
|
| - bool complete() const { return state_ == STATE_COMPLETE; }
|
| - bool error() const { return state_ == STATE_ERROR; }
|
| + bool complete() const {
|
| + // Returns true if candidate allocation has completed one way or another.
|
| + return ((state_ == STATE_COMPLETE) || (state_ == STATE_ERROR));
|
| + }
|
|
|
| void set_ready() { ASSERT(state_ == STATE_INIT); state_ = STATE_READY; }
|
| void set_complete() {
|
| @@ -169,7 +182,7 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
|
| PortData* FindPort(Port* port);
|
| void GetNetworks(std::vector<rtc::Network*>* networks);
|
|
|
| - bool CheckCandidateFilter(const Candidate& c) const;
|
| + bool CheckCandidateFilter(const Candidate& c);
|
|
|
| BasicPortAllocator* allocator_;
|
| rtc::Thread* network_thread_;
|
|
|