Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftNetwork/QUIC/QUICConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,7 @@ public final class QUICConnection: ManyToManyApplicationStreamProtocol,
)

guard
packet.destinationConnectionID == path.dcid
packet.destinationConnectionID == path.scid
|| validateDCIDFromInboundPacket(packet, on: path)
else {
return false
Expand Down
9 changes: 9 additions & 0 deletions Sources/SwiftNetwork/QUIC/QUICConnectionID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ public struct QUICConnectionID: Sendable, Equatable, CustomStringConvertible {
guard lhs.actualLength == rhs.actualLength else {
return false
}
#if !NETWORK_EMBEDDED
return lhs.connectionIDStorage.span.withUnsafeBytes { left in
rhs.connectionIDStorage.span.withUnsafeBytes { right in
memcmp(left.baseAddress!, right.baseAddress!, 20)
}
} == 0
#else
// Fall back to comparing by index
let lhsSpan = lhs._connectionID.span
let rhsSpan = rhs._connectionID.span
for i in 0..<lhs.actualLength {
Expand All @@ -176,6 +184,7 @@ public struct QUICConnectionID: Sendable, Equatable, CustomStringConvertible {
}
}
return true
#endif
}
}

Expand Down
Loading