OLD | NEW |
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 std::string content_name_; | 214 std::string content_name_; |
215 int component_; | 215 int component_; |
216 std::string ice_ufrag_; | 216 std::string ice_ufrag_; |
217 std::string ice_pwd_; | 217 std::string ice_pwd_; |
218 | 218 |
219 // SetIceParameters is an implementation detail which only PortAllocator | 219 // SetIceParameters is an implementation detail which only PortAllocator |
220 // should be able to call. | 220 // should be able to call. |
221 friend class PortAllocator; | 221 friend class PortAllocator; |
222 }; | 222 }; |
223 | 223 |
224 // Every method of PortAllocator (including the destructor) must be called on | 224 // Note that this class should only be used on one thread. |
225 // the same thread, except for the constructor which may be called on any | 225 // This includes calling the destructor. |
226 // thread. | |
227 // | |
228 // This allows constructing a PortAllocator subclass on one thread and | |
229 // passing it into an object that uses it on a different thread. | |
230 class PortAllocator : public sigslot::has_slots<> { | 226 class PortAllocator : public sigslot::has_slots<> { |
231 public: | 227 public: |
232 PortAllocator() : | 228 PortAllocator() : |
233 flags_(kDefaultPortAllocatorFlags), | 229 flags_(kDefaultPortAllocatorFlags), |
234 min_port_(0), | 230 min_port_(0), |
235 max_port_(0), | 231 max_port_(0), |
236 step_delay_(kDefaultStepDelay), | 232 step_delay_(kDefaultStepDelay), |
237 allow_tcp_listen_(true), | 233 allow_tcp_listen_(true), |
238 candidate_filter_(CF_ALL) { | 234 candidate_filter_(CF_ALL) { |
| 235 // This will allow us to have old behavior on non webrtc clients. |
239 } | 236 } |
240 virtual ~PortAllocator() {} | 237 virtual ~PortAllocator() {} |
241 | 238 |
242 // This should be called on the PortAllocator's thread before the | |
243 // PortAllocator is used. Subclasses may override this if necessary. | |
244 virtual void Initialize() {} | |
245 | |
246 // Set STUN and TURN servers to be used in future sessions, and set | 239 // Set STUN and TURN servers to be used in future sessions, and set |
247 // candidate pool size, as described in JSEP. | 240 // candidate pool size, as described in JSEP. |
248 // | 241 // |
249 // If the servers are changing and the candidate pool size is nonzero, | 242 // If the servers are changing and the candidate pool size is nonzero, |
250 // existing pooled sessions will be destroyed and new ones created. | 243 // existing pooled sessions will be destroyed and new ones created. |
251 // | 244 // |
252 // If the servers are not changing but the candidate pool size is, | 245 // If the servers are not changing but the candidate pool size is, |
253 // pooled sessions will be either created or destroyed as necessary. | 246 // pooled sessions will be either created or destroyed as necessary. |
254 void SetConfiguration(const ServerAddresses& stun_servers, | 247 void SetConfiguration(const ServerAddresses& stun_servers, |
255 const std::vector<RelayServerConfig>& turn_servers, | 248 const std::vector<RelayServerConfig>& turn_servers, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 int target_pooled_session_count_ = 0; | 348 int target_pooled_session_count_ = 0; |
356 // This variable represents the total number of pooled sessions | 349 // This variable represents the total number of pooled sessions |
357 // both owned by this class and taken by TakePooledSession. | 350 // both owned by this class and taken by TakePooledSession. |
358 int allocated_pooled_session_count_ = 0; | 351 int allocated_pooled_session_count_ = 0; |
359 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 352 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
360 }; | 353 }; |
361 | 354 |
362 } // namespace cricket | 355 } // namespace cricket |
363 | 356 |
364 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 357 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
OLD | NEW |