瀏覽代碼

Make Server Sendable (#1623)

Gustavo Cairo 2 年之前
父節點
當前提交
5eb37db61c
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Sources/GRPC/Server.swift

+ 3 - 1
Sources/GRPC/Server.swift

@@ -79,7 +79,9 @@ import Network
 ///      HTTP2Frame.FramePayload│                             │HTTP2Frame.FramePayload
 ///                             │                             ▼
 ///
-public final class Server {
+///- Note: This class is thread safe. It's marked as `@unchecked Sendable` because the non-Sendable
+/// `errorDelegate` property is mutated, but it's done thread-safely, as it only happens inside the `EventLoop`.
+public final class Server: @unchecked Sendable {
   /// Makes and configures a `ServerBootstrap` using the provided configuration.
   public class func makeBootstrap(configuration: Configuration) -> ServerBootstrapProtocol {
     let bootstrap = PlatformSupport.makeServerBootstrap(group: configuration.eventLoopGroup)