Title: [279784] trunk/Source/WebKit
Revision
279784
Author
[email protected]
Date
2021-07-09 08:16:37 -0700 (Fri, 09 Jul 2021)

Log Message

Use nw_parameters_allow_sharing_port_with_listener if available
https://bugs.webkit.org/show_bug.cgi?id=227835
<rdar://80312536>

Reviewed by Eric Carlson.

Use nw_parameters_allow_sharing_port_with_listener to allow running local loop connections.
Covered by existing tests running on platforms supporting nw_parameters_allow_sharing_port_with_listener.

* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
* Platform/spi/Cocoa/NWParametersSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (279783 => 279784)


--- trunk/Source/WebKit/ChangeLog	2021-07-09 15:11:43 UTC (rev 279783)
+++ trunk/Source/WebKit/ChangeLog	2021-07-09 15:16:37 UTC (rev 279784)
@@ -1,3 +1,18 @@
+2021-07-09  Youenn Fablet  <[email protected]>
+
+        Use nw_parameters_allow_sharing_port_with_listener if available
+        https://bugs.webkit.org/show_bug.cgi?id=227835
+        <rdar://80312536>
+
+        Reviewed by Eric Carlson.
+
+        Use nw_parameters_allow_sharing_port_with_listener to allow running local loop connections.
+        Covered by existing tests running on platforms supporting nw_parameters_allow_sharing_port_with_listener.
+
+        * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
+        (WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
+        * Platform/spi/Cocoa/NWParametersSPI.h:
+
 2021-07-09  Alexander Mikhaylenko  <[email protected]>
 
         [GTK] Touchscreen navigation swipe doesn't work when the page scrolls horizontally

Modified: trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm (279783 => 279784)


--- trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm	2021-07-09 15:11:43 UTC (rev 279783)
+++ trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm	2021-07-09 15:16:37 UTC (rev 279784)
@@ -279,8 +279,15 @@
         auto hostAddress = m_address.ipaddr().ToString();
         if (m_address.ipaddr().IsNil())
             hostAddress = m_address.hostname();
-        // FIXME: We should use m_address.port() instead of using 0
-        auto localEndpoint = adoptNS(nw_endpoint_create_host(hostAddress.c_str(), "0"));
+#if defined(NW_HAS_SHARE_LISTENER_PORT) && NW_HAS_SHARE_LISTENER_PORT
+        nw_parameters_allow_sharing_port_with_listener(parameters.get(), m_nwListener.get());
+        auto portString = String::number(m_address.port());
+        auto portValue = portString.utf8().data();
+#else
+        // rdar://80176676: we workaround local loop port reuse by using 0 instead of m_address.port().
+        auto portValue = "0";
+#endif
+        auto localEndpoint = adoptNS(nw_endpoint_create_host(hostAddress.c_str(), portValue));
         nw_parameters_set_local_endpoint(parameters.get(), localEndpoint.get());
     }
     configureParameters(parameters.get(), remoteAddress.family() == AF_INET ? nw_ip_version_4 : nw_ip_version_6);

Modified: trunk/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h (279783 => 279784)


--- trunk/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h	2021-07-09 15:11:43 UTC (rev 279783)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h	2021-07-09 15:16:37 UTC (rev 279784)
@@ -38,6 +38,7 @@
 #if HAVE(NWPARAMETERS_TRACKER_API)
 void nw_parameters_set_is_third_party_web_content(nw_parameters_t, bool is_third_party_web_content);
 void nw_parameters_set_is_known_tracker(nw_parameters_t, bool is_known_tracker);
+void nw_parameters_allow_sharing_port_with_listener(nw_parameters_t, nw_listener_t);
 #endif // HAVE(NWPARAMETERS_TRACKER_API)
 
 WTF_EXTERN_C_END
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to