From a555bae157a3ec327068ba58b193f7e41539fc69 Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Tue, 6 Oct 2026 16:08:24 -0400 Subject: [PATCH] Fix `testQUICEcho1MiBAckBundling` build after the handler became `Sendable` `BridgeObserveFrameHandler` became `@Sendable` at the same time as `testQUICEcho1MiBAckBundling` landed, and that test's handler appends to a captured `var`, which Swift 6 rejects in a `@Sendable` closure. The test target no longer builds. The observed packet sizes are now collected in a `Mutex`, as `testQUICDatagramWithLargeInitialPacketSize` already does. --- Tests/SwiftNetworkTests/SwiftNetworkQUICHarnessTests.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tests/SwiftNetworkTests/SwiftNetworkQUICHarnessTests.swift b/Tests/SwiftNetworkTests/SwiftNetworkQUICHarnessTests.swift index 068bfcc5..fcffe0ce 100644 --- a/Tests/SwiftNetworkTests/SwiftNetworkQUICHarnessTests.swift +++ b/Tests/SwiftNetworkTests/SwiftNetworkQUICHarnessTests.swift @@ -572,11 +572,11 @@ final class SwiftNetworkQUICHarnessTests: NetTestCase { // ACKs should be bundled on outgoing STREAM frames rather than going out in their own // packet as much as possible, this test tracks that. func testQUICEcho1MiBAckBundling() { - var packetSizes: [Int] = [] + let observedPacketSizes = Mutex<[Int]>([]) let observeFrameHandler: BridgeObserveFrameHandler = { firstByte, byteCount in // Identify short header packet to accumulate the total sizes at the end guard (firstByte & 0xC0) == 0x40 else { return } - packetSizes.append(byteCount) + observedPacketSizes.withLock { $0.append(byteCount) } } QUICTestHarness().runQUICTest( @@ -585,6 +585,7 @@ final class SwiftNetworkQUICHarnessTests: NetTestCase { bridgeObserveFrameHandler: observeFrameHandler ) + let packetSizes = observedPacketSizes.withLock { $0 } XCTAssertFalse(packetSizes.isEmpty, "packetSizes should not be empty") // A standalone ACK (no STREAM data) fits comfortably under 100 bytes, but a