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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 ProtocolType int_proto, ProtocolType ext_proto) { | 526 ProtocolType int_proto, ProtocolType ext_proto) { |
527 SocketAddress server_addr = | 527 SocketAddress server_addr = |
528 int_proto == PROTO_TCP ? kTurnTcpIntAddr : kTurnUdpIntAddr; | 528 int_proto == PROTO_TCP ? kTurnTcpIntAddr : kTurnUdpIntAddr; |
529 return CreateTurnPort(addr, socket_factory, int_proto, ext_proto, | 529 return CreateTurnPort(addr, socket_factory, int_proto, ext_proto, |
530 server_addr); | 530 server_addr); |
531 } | 531 } |
532 TurnPort* CreateTurnPort(const SocketAddress& addr, | 532 TurnPort* CreateTurnPort(const SocketAddress& addr, |
533 PacketSocketFactory* socket_factory, | 533 PacketSocketFactory* socket_factory, |
534 ProtocolType int_proto, ProtocolType ext_proto, | 534 ProtocolType int_proto, ProtocolType ext_proto, |
535 const rtc::SocketAddress& server_addr) { | 535 const rtc::SocketAddress& server_addr) { |
536 constexpr uint16_t kMinPort = 0; | 536 return TurnPort::Create(&main_, socket_factory, MakeNetwork(addr), 0, 0, |
537 constexpr uint16_t kMaxPort = 0; | |
538 webrtc::RtcEventLog* event_log = nullptr; | |
539 return TurnPort::Create(&main_, socket_factory, MakeNetwork(addr), | |
540 kMinPort, kMaxPort, | |
541 username_, password_, | 537 username_, password_, |
542 ProtocolAddress(server_addr, int_proto), | 538 ProtocolAddress(server_addr, int_proto), |
543 kRelayCredentials, 0, std::string(), event_log); | 539 kRelayCredentials, 0, std::string()); |
544 } | 540 } |
545 RelayPort* CreateGturnPort(const SocketAddress& addr, | 541 RelayPort* CreateGturnPort(const SocketAddress& addr, |
546 ProtocolType int_proto, ProtocolType ext_proto) { | 542 ProtocolType int_proto, ProtocolType ext_proto) { |
547 RelayPort* port = CreateGturnPort(addr); | 543 RelayPort* port = CreateGturnPort(addr); |
548 SocketAddress addrs[] = | 544 SocketAddress addrs[] = |
549 { kRelayUdpIntAddr, kRelayTcpIntAddr, kRelaySslTcpIntAddr }; | 545 { kRelayUdpIntAddr, kRelayTcpIntAddr, kRelaySslTcpIntAddr }; |
550 port->AddServerAddress(ProtocolAddress(addrs[int_proto], int_proto)); | 546 port->AddServerAddress(ProtocolAddress(addrs[int_proto], int_proto)); |
551 return port; | 547 return port; |
552 } | 548 } |
553 RelayPort* CreateGturnPort(const SocketAddress& addr) { | 549 RelayPort* CreateGturnPort(const SocketAddress& addr) { |
(...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); | 2889 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); |
2894 EXPECT_NE(conn1, conn2); | 2890 EXPECT_NE(conn1, conn2); |
2895 conn_in_use = port->GetConnection(address); | 2891 conn_in_use = port->GetConnection(address); |
2896 EXPECT_EQ(conn2, conn_in_use); | 2892 EXPECT_EQ(conn2, conn_in_use); |
2897 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); | 2893 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); |
2898 | 2894 |
2899 // Make sure the new connection was not deleted. | 2895 // Make sure the new connection was not deleted. |
2900 rtc::Thread::Current()->ProcessMessages(300); | 2896 rtc::Thread::Current()->ProcessMessages(300); |
2901 EXPECT_TRUE(port->GetConnection(address) != nullptr); | 2897 EXPECT_TRUE(port->GetConnection(address) != nullptr); |
2902 } | 2898 } |
OLD | NEW |