-
-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Hi, just learned about this library and tried to give it a try to replace another swift SMB library that gave me some issues. So far everything works very smoothly. Thanks for that.
Just one comment/question: When compiling my application with Swift 6 I get these types of errors:
Sending 'self.client' risks causing data races
Sending 'self'-isolated 'self.client' to nonisolated instance method 'login(username:password:domain:workstation:)' risks causing data races between nonisolated and 'self'-isolated uses
My code uses a Connection actor that has a SMBClient contained in it and it complains about using the client. So for instance:
actor Connection : IConnection {
private let client : SMBClient
init() {
// Initialise client.
}
func getFileAttributesAtPath(filePath: String) async throws -> any IAttributes {
let fileStat = try await client.fileStat(path: filePath) // <-- This gives an error
// Do more stuff.
}
Going back to Swift 5 turns these errors into warnings and so far I see no problems while running the app.
I suspect what would help is if the SMBClient would be Sendable. Now I didn't look into how SMBClient is implemented yet, but Is there a fundamental reason why SMBClient is not Sendable? If wanted I can spend some time seeing what it needs to get SMBClient Sendable.