diff --git a/Sources/NIOExtras/PCAPRingBuffer.swift b/Sources/NIOExtras/PCAPRingBuffer.swift index 01da4787..3100f2c8 100644 --- a/Sources/NIOExtras/PCAPRingBuffer.swift +++ b/Sources/NIOExtras/PCAPRingBuffer.swift @@ -76,7 +76,7 @@ public class NIOPCAPRingBuffer { self.popFirst() } precondition(self.pcapFragments.count < self.maximumFragments) - + // Add the new fragment self.append(buffer) diff --git a/Sources/NIOExtras/QuiescingHelper.swift b/Sources/NIOExtras/QuiescingHelper.swift index c1f0f984..193d394b 100644 --- a/Sources/NIOExtras/QuiescingHelper.swift +++ b/Sources/NIOExtras/QuiescingHelper.swift @@ -27,6 +27,7 @@ private final class ChannelCollector { case shuttingDown case shutdownCompleted } + private var openChannels: [ObjectIdentifier: Channel] = [:] private let serverChannel: Channel private var fullyShutdownPromise: EventLoopPromise? = nil @@ -143,6 +144,12 @@ private final class ChannelCollector { } } +#if swift(>=5.5) && canImport(_Concurrency) +extension ChannelCollector: @unchecked Sendable { + +} +#endif + /// A `ChannelHandler` that adds all channels that it receives through the `ChannelPipeline` to a `ChannelCollector`. /// /// - note: This is only useful to be added to a server `Channel` in `ServerBootstrap.serverChannelInitializer`. @@ -250,3 +257,7 @@ public final class ServerQuiescingHelper { } } } + +extension ServerQuiescingHelper: NIOSendable { + +} diff --git a/Sources/NIOExtras/WritePCAPHandler.swift b/Sources/NIOExtras/WritePCAPHandler.swift index c3723a95..b457a231 100644 --- a/Sources/NIOExtras/WritePCAPHandler.swift +++ b/Sources/NIOExtras/WritePCAPHandler.swift @@ -595,7 +595,7 @@ extension NIOWritePCAPHandler { /// A `SynchronizedFileSink` is thread-safe so can be used from any thread/`EventLoop`. After use, you /// _must_ call `syncClose` on the `SynchronizedFileSink` to shut it and all the associated resources down. Failing /// to do so triggers undefined behaviour. - public class SynchronizedFileSink { + public final class SynchronizedFileSink { private let fileHandle: NIOFileHandle private let workQueue: DispatchQueue private let writesGroup = DispatchGroup() @@ -715,3 +715,9 @@ extension NIOWritePCAPHandler { } } } + +#if swift(>=5.5) && canImport(_Concurrency) +extension NIOWritePCAPHandler.SynchronizedFileSink: @unchecked Sendable { + +} +#endif diff --git a/Sources/NIOExtrasPerformanceTester/HTTP1PerformanceTestFramework.swift b/Sources/NIOExtrasPerformanceTester/HTTP1PerformanceTestFramework.swift index 8e20f514..46d1e8c0 100644 --- a/Sources/NIOExtrasPerformanceTester/HTTP1PerformanceTestFramework.swift +++ b/Sources/NIOExtrasPerformanceTester/HTTP1PerformanceTestFramework.swift @@ -128,6 +128,9 @@ class HTTP1ThreadedPerformanceTest: Benchmark { let head: HTTPRequestHead + var group: MultiThreadedEventLoopGroup! + var serverChannel: Channel! + init(numberOfRepeats: Int, numberOfClients: Int, requestsPerClient: Int, @@ -142,9 +145,6 @@ class HTTP1ThreadedPerformanceTest: Benchmark { self.head = head } - var group: MultiThreadedEventLoopGroup! - var serverChannel: Channel! - func setUp() throws { self.group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount) self.serverChannel = try ServerBootstrap(group: self.group) diff --git a/Sources/NIOExtrasPerformanceTester/PCAPPerformanceTest.swift b/Sources/NIOExtrasPerformanceTester/PCAPPerformanceTest.swift index ca3eb1b8..19fc5ead 100644 --- a/Sources/NIOExtrasPerformanceTester/PCAPPerformanceTest.swift +++ b/Sources/NIOExtrasPerformanceTester/PCAPPerformanceTest.swift @@ -17,19 +17,17 @@ import NIOEmbedded import NIOExtras import Foundation -class PCAPPerformanceTest: Benchmark { +final class PCAPPerformanceTest: Benchmark { let numberOfRepeats: Int - let byteBuffer = ByteBuffer(repeating: 0x65, count: 1000) + let outputFile = NSTemporaryDirectory() + "/" + UUID().uuidString init(numberOfRepeats: Int) { self.numberOfRepeats = numberOfRepeats } - var outputFile: String! - func setUp() throws { - self.outputFile = NSTemporaryDirectory() + "/" + UUID().uuidString + } func tearDown() { diff --git a/Sources/NIOExtrasPerformanceTester/RollingPCAPPerformanceTest.swift b/Sources/NIOExtrasPerformanceTester/RollingPCAPPerformanceTest.swift index f2fb1005..0eaf6e6d 100644 --- a/Sources/NIOExtrasPerformanceTester/RollingPCAPPerformanceTest.swift +++ b/Sources/NIOExtrasPerformanceTester/RollingPCAPPerformanceTest.swift @@ -16,7 +16,7 @@ import NIOCore import NIOEmbedded import NIOExtras -class RollingPCAPPerformanceTest: Benchmark { +final class RollingPCAPPerformanceTest: Benchmark { let numberOfRepeats: Int let byteBuffer = ByteBuffer(repeating: 0x65, count: 1000)