Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: webrtc/p2p/base/port.h

Issue 2018693002: Create a new connection if a candidate reuses an address (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const rtc::SocketAddress& base_address, 309 const rtc::SocketAddress& base_address,
310 const rtc::SocketAddress& related_address, 310 const rtc::SocketAddress& related_address,
311 const std::string& protocol, 311 const std::string& protocol,
312 const std::string& relay_protocol, 312 const std::string& relay_protocol,
313 const std::string& tcptype, 313 const std::string& tcptype,
314 const std::string& type, 314 const std::string& type,
315 uint32_t type_preference, 315 uint32_t type_preference,
316 uint32_t relay_preference, 316 uint32_t relay_preference,
317 bool final); 317 bool final);
318 318
319 // Adds the given connection to the list. (Deleting removes them.) 319 // Adds the given connection to the map keyed by the remote candidate address.
320 void AddConnection(Connection* conn); 320 // If an existing connection has the same address, the existing one will be
321 // replaced and destroyed.
322 void AddOrReplaceConnection(Connection* conn);
321 323
322 // Called when a packet is received from an unknown address that is not 324 // Called when a packet is received from an unknown address that is not
323 // currently a connection. If this is an authenticated STUN binding request, 325 // currently a connection. If this is an authenticated STUN binding request,
324 // then we will signal the client. 326 // then we will signal the client.
325 void OnReadPacket(const char* data, size_t size, 327 void OnReadPacket(const char* data, size_t size,
326 const rtc::SocketAddress& addr, 328 const rtc::SocketAddress& addr,
327 ProtocolType proto); 329 ProtocolType proto);
328 330
329 // If the given data comprises a complete and correct STUN message then the 331 // If the given data comprises a complete and correct STUN message then the
330 // return value is true, otherwise false. If the message username corresponds 332 // return value is true, otherwise false. If the message username corresponds
331 // with this port's username fragment, msg will contain the parsed STUN 333 // with this port's username fragment, msg will contain the parsed STUN
332 // message. Otherwise, the function may send a STUN response internally. 334 // message. Otherwise, the function may send a STUN response internally.
333 // remote_username contains the remote fragment of the STUN username. 335 // remote_username contains the remote fragment of the STUN username.
334 bool GetStunMessage(const char* data, 336 bool GetStunMessage(const char* data,
335 size_t size, 337 size_t size,
336 const rtc::SocketAddress& addr, 338 const rtc::SocketAddress& addr,
337 std::unique_ptr<IceMessage>* out_msg, 339 std::unique_ptr<IceMessage>* out_msg,
338 std::string* out_username); 340 std::string* out_username);
339 341
340 // Checks if the address in addr is compatible with the port's ip. 342 // Checks if the address in addr is compatible with the port's ip.
341 bool IsCompatibleAddress(const rtc::SocketAddress& addr); 343 bool IsCompatibleAddress(const rtc::SocketAddress& addr);
342 344
343 // Returns default DSCP value. 345 // Returns default DSCP value.
344 rtc::DiffServCodePoint DefaultDscpValue() const { 346 rtc::DiffServCodePoint DefaultDscpValue() const {
345 // No change from what MediaChannel set. 347 // No change from what MediaChannel set.
346 return rtc::DSCP_NO_CHANGE; 348 return rtc::DSCP_NO_CHANGE;
347 } 349 }
348 350
351 // Extra work to be done in subclasses when a connection is destroyed.
352 virtual void HandleConnectionDestroyed(Connection* conn) {}
353
349 private: 354 private:
350 void Construct(); 355 void Construct();
351 // Called when one of our connections deletes itself. 356 // Called when one of our connections deletes itself.
352 void OnConnectionDestroyed(Connection* conn); 357 void OnConnectionDestroyed(Connection* conn);
353 358
354 // Whether this port is dead, and hence, should be destroyed on the controlled 359 // Whether this port is dead, and hence, should be destroyed on the controlled
355 // side. 360 // side.
356 bool dead() const { 361 bool dead() const {
357 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty(); 362 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty();
358 } 363 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 const rtc::PacketOptions& options) override; 671 const rtc::PacketOptions& options) override;
667 int GetError() override { return error_; } 672 int GetError() override { return error_; }
668 673
669 private: 674 private:
670 int error_ = 0; 675 int error_ = 0;
671 }; 676 };
672 677
673 } // namespace cricket 678 } // namespace cricket
674 679
675 #endif // WEBRTC_P2P_BASE_PORT_H_ 680 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698