From 8a9e441c0bb4b3d8605154e55f5e91b661191271 Mon Sep 17 00:00:00 2001 From: Jelle Foks Date: Wed, 16 Oct 2024 13:32:25 -0700 Subject: [PATCH] Fix for ipv6 socket test where ipv6 doesn't work. (#4274) Since #4270, UDP socket connections are no longer silently ignored. Starboard can not return ERR_ADDRESS_UNREACHABLE and will instead return ERR_FAILED. This changes UDPSocketTest.ClientGetLocalPeerAddresses to allow that return value for ipv6 connections. b/373726636 b/205134049 --- base/task/single_thread_task_executor_unittest.cc | 2 +- net/socket/udp_socket_unittest.cc | 6 ++++++ starboard/shared/win32/socket_send_to.cc | 6 ------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/base/task/single_thread_task_executor_unittest.cc b/base/task/single_thread_task_executor_unittest.cc index 5167b01065af..703733379912 100644 --- a/base/task/single_thread_task_executor_unittest.cc +++ b/base/task/single_thread_task_executor_unittest.cc @@ -1257,7 +1257,7 @@ TEST_P(SingleThreadTaskExecutorTypedTest, RunLoopQuitOrderAfter) { // On Linux, the pipe buffer size is 64KiB by default. The bug caused one byte // accumulated in the pipe per two posts, so we should repeat 128K times to // reproduce the bug. -#if BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) || defined(STARBOARD) // TODO(crbug.com/1188497): This test is unreasonably slow on CrOS and flakily // times out (100x slower than other platforms which take < 1s to complete // it). diff --git a/net/socket/udp_socket_unittest.cc b/net/socket/udp_socket_unittest.cc index 78d4ae4a9510..45590a9427fa 100644 --- a/net/socket/udp_socket_unittest.cc +++ b/net/socket/udp_socket_unittest.cc @@ -592,7 +592,13 @@ TEST_F(UDPSocketTest, ClientGetLocalPeerAddresses) { UDPClientSocket client(DatagramSocket::DEFAULT_BIND, nullptr, NetLogSource()); int rv = client.Connect(remote_address); +#if defined(STARBOARD) + // Starboard currently can not return ERR_ADDRESS_UNREACHABLE and instead + // will return ERR_FAILED. + if (test.may_fail && (rv == ERR_ADDRESS_UNREACHABLE || rv == ERR_FAILED)) { +#else if (test.may_fail && rv == ERR_ADDRESS_UNREACHABLE) { +#endif // Connect() may return ERR_ADDRESS_UNREACHABLE for IPv6 // addresses if IPv6 is not configured. continue; diff --git a/starboard/shared/win32/socket_send_to.cc b/starboard/shared/win32/socket_send_to.cc index b7ac3dce8701..791034a5ba44 100644 --- a/starboard/shared/win32/socket_send_to.cc +++ b/starboard/shared/win32/socket_send_to.cc @@ -70,12 +70,6 @@ int SbSocketSendTo(SbSocket socket, socket->error = sbwin32::TranslateSocketErrorStatus(last_error); return -1; } else if (socket->protocol == kSbSocketProtocolUdp) { - if (!destination) { - SB_DLOG(FATAL) << "No destination passed to UDP send."; - socket->error = kSbSocketErrorFailed; - return -1; - } - sbwin32::SockAddr sock_addr; const sockaddr* sockaddr = nullptr; socklen_t sockaddr_length = 0;