mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-26 02:27:14 +00:00
fix: resolve additional bugs identified in code review
- core: remove DispatchGroup from MediaExtractionEngine to fix hanging on yt-dlp launch failure - core: clear readabilityHandlers in Aria2DownloadEngine if process fails to launch - core: fix TOCTOU type warning for findFreePort - build: fix inverted logic in Mach-O validation script - ci: fix hardcoded macOS SDK version check in release workflow - ci: prevent workflow_dispatch from failing on verify-tag
This commit is contained in:
@@ -10,7 +10,7 @@ final class Aria2DownloadEngine: Sendable {
|
||||
let cancel: @Sendable () -> Void
|
||||
}
|
||||
|
||||
static func findFreePort() -> Int {
|
||||
static func findFreePort() -> UInt16 {
|
||||
var port: UInt16 = 6800
|
||||
let parameters = NWParameters.tcp
|
||||
for p in 6800...6900 {
|
||||
@@ -21,7 +21,7 @@ final class Aria2DownloadEngine: Sendable {
|
||||
break
|
||||
}
|
||||
}
|
||||
return Int(port)
|
||||
return port
|
||||
}
|
||||
|
||||
enum EngineError: LocalizedError {
|
||||
@@ -120,7 +120,7 @@ final class Aria2DownloadEngine: Sendable {
|
||||
var lastError: Error?
|
||||
|
||||
for _ in 1...5 {
|
||||
let rpcPort = Self.findFreePort()
|
||||
let rpcPort = Int(Self.findFreePort())
|
||||
let rpcSecret = UUID().uuidString
|
||||
let tempDir = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("firelink-aria2-\(UUID().uuidString)")
|
||||
|
||||
@@ -221,6 +221,8 @@ final class Aria2DownloadEngine: Sendable {
|
||||
}
|
||||
|
||||
if didThrow {
|
||||
outputPipe.fileHandleForReading.readabilityHandler = nil
|
||||
errorPipe.fileHandleForReading.readabilityHandler = nil
|
||||
try? FileManager.default.removeItem(at: tempDir)
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user