diff --git a/Package.swift b/Package.swift index e95ec57..9560b0e 100644 --- a/Package.swift +++ b/Package.swift @@ -155,7 +155,8 @@ var targets: [PackageDescription.Target] = [ name: "NIONFS3", dependencies: [ .product(name: "NIOCore", package: "swift-nio") - ] + ], + swiftSettings: strictConcurrencySettings ), .testTarget( name: "NIONFS3Tests", @@ -164,7 +165,8 @@ var targets: [PackageDescription.Target] = [ .product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOEmbedded", package: "swift-nio"), .product(name: "NIOTestUtils", package: "swift-nio"), - ] + ], + swiftSettings: strictConcurrencySettings ), .target( name: "NIOHTTPTypes", diff --git a/Sources/NIONFS3/NFSCallDecoder.swift b/Sources/NIONFS3/NFSCallDecoder.swift index ba9dbab..dc347c7 100644 --- a/Sources/NIONFS3/NFSCallDecoder.swift +++ b/Sources/NIONFS3/NFSCallDecoder.swift @@ -14,7 +14,7 @@ import NIOCore -public struct NFS3CallDecoder: NIOSingleStepByteToMessageDecoder { +public struct NFS3CallDecoder: NIOSingleStepByteToMessageDecoder, Sendable { public typealias InboundOut = RPCNFS3Call public init() {} diff --git a/Sources/NIONFS3/NFSCallEncoder.swift b/Sources/NIONFS3/NFSCallEncoder.swift index 6867a8a..c10ba51 100644 --- a/Sources/NIONFS3/NFSCallEncoder.swift +++ b/Sources/NIONFS3/NFSCallEncoder.swift @@ -14,7 +14,7 @@ import NIOCore -public struct NFS3CallEncoder: MessageToByteEncoder { +public struct NFS3CallEncoder: MessageToByteEncoder, Sendable { public typealias OutboundIn = RPCNFS3Call public init() {} diff --git a/Sources/NIONFS3/NFSFileSystem.swift b/Sources/NIONFS3/NFSFileSystem.swift index 67a10c9..e12c5e5 100644 --- a/Sources/NIONFS3/NFSFileSystem.swift +++ b/Sources/NIONFS3/NFSFileSystem.swift @@ -14,7 +14,11 @@ import NIOCore -public protocol NFS3FileSystemNoAuth { +@preconcurrency +public protocol NFS3FileSystemNoAuth: Sendable { + // Must be Sendable; there are extensions which take an event loop and call these functions + // on that event loop. + func mount(_ call: MountCallMount, promise: EventLoopPromise) func unmount(_ call: MountCallUnmount, promise: EventLoopPromise) func getattr(_ call: NFS3CallGetAttr, promise: EventLoopPromise) diff --git a/Sources/NIONFS3/NFSFileSystemHandler.swift b/Sources/NIONFS3/NFSFileSystemHandler.swift index c49ad0d..637bbe4 100644 --- a/Sources/NIONFS3/NFSFileSystemHandler.swift +++ b/Sources/NIONFS3/NFSFileSystemHandler.swift @@ -22,7 +22,7 @@ import NIOCore /// `NFS3FileSystemNoAuthHandler` ignores any [SUN RPC](https://datatracker.ietf.org/doc/html/rfc5531) credentials / /// verifiers and always replies with `AUTH_NONE`. If you need to implement access control via UNIX user/group, this /// handler will not be enough. It assumes that every call is allowed. Please note that this is not a security risk -/// because NFS3 tranditionally just trusts the UNIX uid/gid that the client provided. So there's no security value +/// because NFS3 traditionally just trusts the UNIX uid/gid that the client provided. So there's no security value /// added by verifying them. However, the client may rely on the server to check the UNIX permissions (whilst trusting /// the uid/gid) which cannot be done with this handler. public final class NFS3FileSystemNoAuthHandler: ChannelDuplexHandler, NFS3FileSystemResponder @@ -118,3 +118,6 @@ public final class NFS3FileSystemNoAuthHandler: Channe context.fireErrorCaught(error) } } + +@available(*, unavailable) +extension NFS3FileSystemNoAuthHandler: Sendable {} diff --git a/Sources/NIONFS3/NFSFileSystemInvoker.swift b/Sources/NIONFS3/NFSFileSystemInvoker.swift index c117efa..55030c9 100644 --- a/Sources/NIONFS3/NFSFileSystemInvoker.swift +++ b/Sources/NIONFS3/NFSFileSystemInvoker.swift @@ -39,7 +39,7 @@ internal struct NFS3FileSystemInvoker) { promise.succeed(()) }