Title: [279464] trunk/Source/WebKit
- Revision
- 279464
- Author
- you...@apple.com
- Date
- 2021-07-01 08:58:00 -0700 (Thu, 01 Jul 2021)
Log Message
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
<rdar://problem/79859045>
Unreviewed, post commit fix.
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h:
(WTF::HashTraits<rtc::SocketAddress>::constructDeletedValue):
(WTF::HashTraits<rtc::SocketAddress>::isDeletedValue):
No need to set all deleted value slots, instead just rely on scope id being equal to numeric_limits<int>::min.
Also ensure we do not add an empty/deleted address to the map.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (279463 => 279464)
--- trunk/Source/WebKit/ChangeLog 2021-07-01 13:29:07 UTC (rev 279463)
+++ trunk/Source/WebKit/ChangeLog 2021-07-01 15:58:00 UTC (rev 279464)
@@ -2,7 +2,21 @@
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
+ <rdar://problem/79859045>
+ Unreviewed, post commit fix.
+
+ * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h:
+ (WTF::HashTraits<rtc::SocketAddress>::constructDeletedValue):
+ (WTF::HashTraits<rtc::SocketAddress>::isDeletedValue):
+ No need to set all deleted value slots, instead just rely on scope id being equal to numeric_limits<int>::min.
+ Also ensure we do not add an empty/deleted address to the map.
+
+2021-07-01 Youenn Fablet <you...@apple.com>
+
+ [Cocoa] Migrate WebRTC UDP socket handling to NW API
+ https://bugs.webkit.org/show_bug.cgi?id=227210
+
Reviewed by Eric Carlson.
Migrate UDP socket handling from WebRTC physical socket server to nw API for Cocoa ports.
Modified: trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h (279463 => 279464)
--- trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h 2021-07-01 13:29:07 UTC (rev 279463)
+++ trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h 2021-07-01 15:58:00 UTC (rev 279464)
@@ -29,6 +29,7 @@
#include "NetworkRTCProvider.h"
#include <Network/Network.h>
+#include <limits>
#include <wtf/HashMap.h>
#include <wtf/Lock.h>
@@ -46,8 +47,8 @@
template<> struct HashTraits<rtc::SocketAddress> : GenericHashTraits<rtc::SocketAddress> {
static rtc::SocketAddress emptyValue() { return rtc::SocketAddress { }; }
- static void constructDeletedValue(rtc::SocketAddress& address) { address = { }; address.SetScopeID(-1); }
- static bool isDeletedValue(const rtc::SocketAddress& address) { return address.scope_id() == -1; }
+ static void constructDeletedValue(rtc::SocketAddress& address) { address.SetScopeID(std::numeric_limits<int>::min()); }
+ static bool isDeletedValue(const rtc::SocketAddress& address) { return address.scope_id() == std::numeric_limits<int>::min(); }
};
}
Modified: trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm (279463 => 279464)
--- trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm 2021-07-01 13:29:07 UTC (rev 279463)
+++ trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm 2021-07-01 15:58:00 UTC (rev 279464)
@@ -168,6 +168,8 @@
return;
auto remoteAddress = socketAddressFromIncomingConnection(connection);
+ ASSERT(remoteAddress != HashTraits<rtc::SocketAddress>::emptyValue() && !HashTraits<rtc::SocketAddress>::isDeletedValue(remoteAddress));
+
protectedThis->m_nwConnections.set(remoteAddress, connection);
protectedThis->setupNWConnection(connection, remoteAddress);
}).get());
@@ -253,6 +255,11 @@
void NetworkRTCUDPSocketCocoaConnections::sendTo(const uint8_t* data, size_t size, const rtc::SocketAddress& remoteAddress, const rtc::PacketOptions& options)
{
+ bool isInCorrectValue = (remoteAddress == HashTraits<rtc::SocketAddress>::emptyValue()) || HashTraits<rtc::SocketAddress>::isDeletedValue(remoteAddress);
+ ASSERT(!isInCorrectValue);
+ if (isInCorrectValue)
+ return;
+
nw_connection_t nwConnection;
{
Locker locker { m_nwConnectionsLock };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes