Fix actor-isolation warning in CLIServerService's connection handler
sendAndClose is main-actor-isolated (implicit under -default-isolation MainActor), but the Task in readRequest's Network.framework callback runs nonisolated (DisableOutwardActorInference means it no longer inherits the class's actor from lexical context). Calling sendAndClose without hopping onto the actor is a hard error in Swift 6 mode.
This commit is contained in:
@@ -132,7 +132,7 @@ final class CLIServerService {
|
||||
if let body = Self.parseRequestBody(from: buffer) {
|
||||
Task {
|
||||
let responseData = await self.processRequest(body)
|
||||
self.sendAndClose(responseData, on: connection)
|
||||
await self.sendAndClose(responseData, on: connection)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user