Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "webrtc/p2p/base/portinterface.h" | 29 #include "webrtc/p2p/base/portinterface.h" |
| 30 #include "webrtc/p2p/base/transport.h" | 30 #include "webrtc/p2p/base/transport.h" |
| 31 #include "webrtc/p2p/base/transportchannelimpl.h" | 31 #include "webrtc/p2p/base/transportchannelimpl.h" |
| 32 #include "webrtc/base/asyncpacketsocket.h" | 32 #include "webrtc/base/asyncpacketsocket.h" |
| 33 #include "webrtc/base/sigslot.h" | 33 #include "webrtc/base/sigslot.h" |
| 34 | 34 |
| 35 namespace cricket { | 35 namespace cricket { |
| 36 | 36 |
| 37 extern const uint32_t WEAK_PING_DELAY; | 37 extern const uint32_t WEAK_PING_DELAY; |
| 38 | 38 |
| 39 struct IceGeneration { | |
|
pthatcher1
2015/12/10 22:08:06
Now that I see the code, I see that it gets confus
honghaiz3
2015/12/11 04:47:29
Done.
| |
| 40 std::string ufrag; | |
| 41 std::string pwd; | |
| 42 IceGeneration(const std::string& ice_ufrag, const std::string& ice_pwd) { | |
|
pthatcher1
2015/12/10 22:08:06
Could be:
IceGenration(const std::string& ufrag,
honghaiz3
2015/12/11 04:47:29
Done.
| |
| 43 ufrag = ice_ufrag; | |
| 44 pwd = ice_pwd; | |
| 45 } | |
| 46 }; | |
| 47 | |
| 39 // Adds the port on which the candidate originated. | 48 // Adds the port on which the candidate originated. |
| 40 class RemoteCandidate : public Candidate { | 49 class RemoteCandidate : public Candidate { |
| 41 public: | 50 public: |
| 42 RemoteCandidate(const Candidate& c, PortInterface* origin_port) | 51 RemoteCandidate(const Candidate& c, PortInterface* origin_port) |
| 43 : Candidate(c), origin_port_(origin_port) {} | 52 : Candidate(c), origin_port_(origin_port) {} |
| 44 | 53 |
| 45 PortInterface* origin_port() { return origin_port_; } | 54 PortInterface* origin_port() { return origin_port_; } |
| 46 | 55 |
| 47 private: | 56 private: |
| 48 PortInterface* origin_port_; | 57 PortInterface* origin_port_; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 void OnNominated(Connection* conn); | 231 void OnNominated(Connection* conn); |
| 223 | 232 |
| 224 void OnMessage(rtc::Message* pmsg) override; | 233 void OnMessage(rtc::Message* pmsg) override; |
| 225 void OnSort(); | 234 void OnSort(); |
| 226 void OnCheckAndPing(); | 235 void OnCheckAndPing(); |
| 227 | 236 |
| 228 void PruneConnections(); | 237 void PruneConnections(); |
| 229 Connection* best_nominated_connection() const; | 238 Connection* best_nominated_connection() const; |
| 230 bool IsBackupConnection(Connection* conn) const; | 239 bool IsBackupConnection(Connection* conn) const; |
| 231 | 240 |
| 241 // Makes sure |remote_ice_generations_| is not empty before calling this. | |
| 242 std::string& remote_ice_ufrag() { | |
| 243 ASSERT(!remote_ice_generations_.empty()); | |
| 244 return remote_ice_generations_.back().ufrag; | |
| 245 } | |
| 246 // Makes sure |remote_ice_generations_| is not empty before calling this. | |
| 247 std::string& remote_ice_pwd() { | |
| 248 ASSERT(!remote_ice_generations_.empty()); | |
| 249 return remote_ice_generations_.back().pwd; | |
| 250 } | |
|
pthatcher1
2015/12/10 22:08:06
I think it would be better to have a remote_ice()
honghaiz3
2015/12/11 04:47:29
Done.
| |
| 251 int remote_ice_generation() { | |
| 252 // When |remote_ice_generations_| has one element, it is generation 0. | |
| 253 return remote_ice_generations_.size() - 1; | |
| 254 } | |
| 255 | |
| 232 P2PTransport* transport_; | 256 P2PTransport* transport_; |
| 233 PortAllocator* allocator_; | 257 PortAllocator* allocator_; |
| 234 rtc::Thread* worker_thread_; | 258 rtc::Thread* worker_thread_; |
| 235 bool incoming_only_; | 259 bool incoming_only_; |
| 236 int error_; | 260 int error_; |
| 237 std::vector<PortAllocatorSession*> allocator_sessions_; | 261 std::vector<PortAllocatorSession*> allocator_sessions_; |
| 238 std::vector<PortInterface *> ports_; | 262 std::vector<PortInterface *> ports_; |
| 239 std::vector<Connection *> connections_; | 263 std::vector<Connection *> connections_; |
| 240 Connection* best_connection_; | 264 Connection* best_connection_; |
| 241 // Connection selected by the controlling agent. This should be used only | 265 // Connection selected by the controlling agent. This should be used only |
| 242 // at controlled side when protocol type is RFC5245. | 266 // at controlled side when protocol type is RFC5245. |
| 243 Connection* pending_best_connection_; | 267 Connection* pending_best_connection_; |
| 244 std::vector<RemoteCandidate> remote_candidates_; | 268 std::vector<RemoteCandidate> remote_candidates_; |
| 245 bool sort_dirty_; // indicates whether another sort is needed right now | 269 bool sort_dirty_; // indicates whether another sort is needed right now |
| 246 bool had_connection_ = false; // if connections_ has ever been nonempty | 270 bool had_connection_ = false; // if connections_ has ever been nonempty |
| 247 typedef std::map<rtc::Socket::Option, int> OptionMap; | 271 typedef std::map<rtc::Socket::Option, int> OptionMap; |
| 248 OptionMap options_; | 272 OptionMap options_; |
| 249 std::string ice_ufrag_; | 273 std::string ice_ufrag_; |
| 250 std::string ice_pwd_; | 274 std::string ice_pwd_; |
| 251 std::string remote_ice_ufrag_; | 275 std::vector<IceGeneration> remote_ice_generations_; |
|
pthatcher1
2015/12/10 22:08:06
And remote_ice_parameters_ might make sense here.
honghaiz3
2015/12/11 04:47:29
Done.
| |
| 252 std::string remote_ice_pwd_; | |
| 253 IceMode remote_ice_mode_; | 276 IceMode remote_ice_mode_; |
| 254 IceRole ice_role_; | 277 IceRole ice_role_; |
| 255 uint64_t tiebreaker_; | 278 uint64_t tiebreaker_; |
| 256 uint32_t remote_candidate_generation_; | |
| 257 IceGatheringState gathering_state_; | 279 IceGatheringState gathering_state_; |
| 258 | 280 |
| 259 int check_receiving_delay_; | 281 int check_receiving_delay_; |
| 260 int receiving_timeout_; | 282 int receiving_timeout_; |
| 261 int backup_connection_ping_interval_; | 283 int backup_connection_ping_interval_; |
| 262 uint32_t last_ping_sent_ms_ = 0; | 284 uint32_t last_ping_sent_ms_ = 0; |
| 263 bool gather_continually_ = false; | 285 bool gather_continually_ = false; |
| 264 int weak_ping_delay_ = WEAK_PING_DELAY; | 286 int weak_ping_delay_ = WEAK_PING_DELAY; |
| 265 TransportChannelState state_ = TransportChannelState::STATE_INIT; | 287 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
| 266 | 288 |
| 267 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 289 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
| 268 }; | 290 }; |
| 269 | 291 |
| 270 } // namespace cricket | 292 } // namespace cricket |
| 271 | 293 |
| 272 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 294 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
| OLD | NEW |