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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 | 153 |
154 int receiving_timeout() const { return receiving_timeout_; } | 154 int receiving_timeout() const { return receiving_timeout_; } |
155 int check_receiving_delay() const { return check_receiving_delay_; } | 155 int check_receiving_delay() const { return check_receiving_delay_; } |
156 | 156 |
157 // Helper method used only in unittest. | 157 // Helper method used only in unittest. |
158 rtc::DiffServCodePoint DefaultDscpValue() const; | 158 rtc::DiffServCodePoint DefaultDscpValue() const; |
159 | 159 |
160 // Public for unit tests. | 160 // Public for unit tests. |
161 Connection* FindNextPingableConnection(); | 161 Connection* FindNextPingableConnection(); |
162 | 162 |
163 // Public for testing only. | |
164 // |connections_| should not be changed from outside. | |
165 const std::vector<Connection*>& connections() { return connections_; } | |
166 | |
163 private: | 167 private: |
164 rtc::Thread* thread() { return worker_thread_; } | 168 rtc::Thread* thread() { return worker_thread_; } |
165 PortAllocatorSession* allocator_session() { | 169 PortAllocatorSession* allocator_session() { |
166 return allocator_sessions_.back(); | 170 return allocator_sessions_.back(); |
167 } | 171 } |
168 | 172 |
173 bool weak() const; | |
pthatcher1
2015/09/17 22:01:17
Needs a comment.
honghaiz3
2015/09/21 22:53:42
Done.
| |
174 | |
169 void Allocate(); | 175 void Allocate(); |
170 void UpdateConnectionStates(); | 176 void UpdateConnectionStates(); |
171 void RequestSort(); | 177 void RequestSort(); |
172 void SortConnections(); | 178 void SortConnections(); |
173 void SwitchBestConnectionTo(Connection* conn); | 179 void SwitchBestConnectionTo(Connection* conn); |
174 void UpdateChannelState(); | 180 void UpdateChannelState(); |
175 void HandleWritable(); | 181 void HandleWritable(); |
176 void HandleNotWritable(); | 182 void HandleNotWritable(); |
177 void HandleAllTimedOut(); | 183 void HandleAllTimedOut(); |
178 | 184 |
179 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; | 185 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; |
180 bool CreateConnections(const Candidate &remote_candidate, | 186 bool CreateConnections(const Candidate& remote_candidate, |
181 PortInterface* origin_port, bool readable); | 187 PortInterface* origin_port); |
182 bool CreateConnection(PortInterface* port, const Candidate& remote_candidate, | 188 bool CreateConnection(PortInterface* port, |
183 PortInterface* origin_port, bool readable); | 189 const Candidate& remote_candidate, |
190 PortInterface* origin_port); | |
184 bool FindConnection(cricket::Connection* connection) const; | 191 bool FindConnection(cricket::Connection* connection) const; |
185 | 192 |
186 uint32 GetRemoteCandidateGeneration(const Candidate& candidate); | 193 uint32 GetRemoteCandidateGeneration(const Candidate& candidate); |
187 bool IsDuplicateRemoteCandidate(const Candidate& candidate); | 194 bool IsDuplicateRemoteCandidate(const Candidate& candidate); |
188 void RememberRemoteCandidate(const Candidate& remote_candidate, | 195 void RememberRemoteCandidate(const Candidate& remote_candidate, |
189 PortInterface* origin_port); | 196 PortInterface* origin_port); |
190 bool IsPingable(Connection* conn); | 197 bool IsPingable(Connection* conn); |
191 void PingConnection(Connection* conn); | 198 void PingConnection(Connection* conn); |
192 void AddAllocatorSession(PortAllocatorSession* session); | 199 void AddAllocatorSession(PortAllocatorSession* session); |
193 void AddConnection(Connection* connection); | 200 void AddConnection(Connection* connection); |
(...skipping 14 matching lines...) Expand all Loading... | |
208 void OnConnectionStateChange(Connection* connection); | 215 void OnConnectionStateChange(Connection* connection); |
209 void OnReadPacket(Connection *connection, const char *data, size_t len, | 216 void OnReadPacket(Connection *connection, const char *data, size_t len, |
210 const rtc::PacketTime& packet_time); | 217 const rtc::PacketTime& packet_time); |
211 void OnReadyToSend(Connection* connection); | 218 void OnReadyToSend(Connection* connection); |
212 void OnConnectionDestroyed(Connection *connection); | 219 void OnConnectionDestroyed(Connection *connection); |
213 | 220 |
214 void OnNominated(Connection* conn); | 221 void OnNominated(Connection* conn); |
215 | 222 |
216 virtual void OnMessage(rtc::Message *pmsg); | 223 virtual void OnMessage(rtc::Message *pmsg); |
217 void OnSort(); | 224 void OnSort(); |
218 void OnPing(); | 225 void OnCheckAndPing(); |
219 | |
220 void OnCheckReceiving(); | |
221 | 226 |
222 void PruneConnections(); | 227 void PruneConnections(); |
223 Connection* best_nominated_connection() const; | 228 Connection* best_nominated_connection() const; |
224 | 229 |
225 P2PTransport* transport_; | 230 P2PTransport* transport_; |
226 PortAllocator *allocator_; | 231 PortAllocator *allocator_; |
227 rtc::Thread *worker_thread_; | 232 rtc::Thread *worker_thread_; |
228 bool incoming_only_; | 233 bool incoming_only_; |
229 bool waiting_for_signaling_; | 234 bool waiting_for_signaling_; |
230 int error_; | 235 int error_; |
231 std::vector<PortAllocatorSession*> allocator_sessions_; | 236 std::vector<PortAllocatorSession*> allocator_sessions_; |
232 std::vector<PortInterface *> ports_; | 237 std::vector<PortInterface *> ports_; |
233 std::vector<Connection *> connections_; | 238 std::vector<Connection *> connections_; |
234 Connection* best_connection_; | 239 Connection* best_connection_; |
235 // Connection selected by the controlling agent. This should be used only | 240 // Connection selected by the controlling agent. This should be used only |
236 // at controlled side when protocol type is RFC5245. | 241 // at controlled side when protocol type is RFC5245. |
237 Connection* pending_best_connection_; | 242 Connection* pending_best_connection_; |
243 Connection* next_connection_to_ping_; | |
238 std::vector<RemoteCandidate> remote_candidates_; | 244 std::vector<RemoteCandidate> remote_candidates_; |
239 bool sort_dirty_; // indicates whether another sort is needed right now | 245 bool sort_dirty_; // indicates whether another sort is needed right now |
240 bool was_writable_; | 246 bool was_writable_; |
241 typedef std::map<rtc::Socket::Option, int> OptionMap; | 247 typedef std::map<rtc::Socket::Option, int> OptionMap; |
242 OptionMap options_; | 248 OptionMap options_; |
243 std::string ice_ufrag_; | 249 std::string ice_ufrag_; |
244 std::string ice_pwd_; | 250 std::string ice_pwd_; |
245 std::string remote_ice_ufrag_; | 251 std::string remote_ice_ufrag_; |
246 std::string remote_ice_pwd_; | 252 std::string remote_ice_pwd_; |
247 IceMode remote_ice_mode_; | 253 IceMode remote_ice_mode_; |
248 IceRole ice_role_; | 254 IceRole ice_role_; |
249 uint64 tiebreaker_; | 255 uint64 tiebreaker_; |
250 uint32 remote_candidate_generation_; | 256 uint32 remote_candidate_generation_; |
251 | 257 |
252 int check_receiving_delay_; | 258 int check_receiving_delay_; |
253 int receiving_timeout_; | 259 int receiving_timeout_; |
260 int ping_delay_; | |
261 uint32 last_ping_sent_; | |
254 | 262 |
255 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 263 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
256 }; | 264 }; |
257 | 265 |
258 } // namespace cricket | 266 } // namespace cricket |
259 | 267 |
260 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 268 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |