diff --git a/Sources/StatsdClient/StatsdClient.swift b/Sources/StatsdClient/StatsdClient.swift index 2508ac8..9730f2f 100644 --- a/Sources/StatsdClient/StatsdClient.swift +++ b/Sources/StatsdClient/StatsdClient.swift @@ -447,7 +447,7 @@ private final class Client: @unchecked Sendable { return bootstrap.bind(host: self.address.protocol == .inet6 ? "::" : "0.0.0.0", port: 0) } - private final class Encoder: ChannelOutboundHandler { + private final class Encoder: ChannelOutboundHandler, Sendable { public typealias OutboundIn = Metric public typealias OutboundOut = AddressedEnvelope diff --git a/Tests/StatsdClientTests/TestServer.swift b/Tests/StatsdClientTests/TestServer.swift index e06ebb2..1650b91 100644 --- a/Tests/StatsdClientTests/TestServer.swift +++ b/Tests/StatsdClientTests/TestServer.swift @@ -36,7 +36,9 @@ final class TestServer: @unchecked Sendable { func connect() -> EventLoopFuture { let bootstrap = DatagramBootstrap(group: self.eventLoopGroup) .channelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1) - .channelInitializer { channel in channel.pipeline.addHandler(Aggregator(delegate: self.store)) } + .channelInitializer { channel in + channel.pipeline.addHandler(Aggregator(delegate: { self.store(address: $0, value: $1) })) + } return bootstrap.bind(host: self.host, port: self.port).map { _ in () } } @@ -57,12 +59,12 @@ final class TestServer: @unchecked Sendable { } } - class Aggregator: ChannelInboundHandler { + final class Aggregator: ChannelInboundHandler, Sendable { typealias InboundIn = AddressedEnvelope - let delegate: (SocketAddress, String) -> Void + let delegate: @Sendable (SocketAddress, String) -> Void - init(delegate: @escaping (SocketAddress, String) -> Void) { + init(delegate: @escaping @Sendable (SocketAddress, String) -> Void) { self.delegate = delegate }