mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 14:53:25 +01:00
[AltDaemon] Fixes XPC service lookup for Odyssey jailbreak
This commit is contained in:
@@ -41,6 +41,8 @@ struct Server: Equatable
|
||||
|
||||
var isPreferred = false
|
||||
var connectionType: ConnectionType = .wireless
|
||||
|
||||
var machServiceName: String?
|
||||
}
|
||||
|
||||
extension Server
|
||||
|
||||
@@ -76,7 +76,7 @@ extension ServerManager
|
||||
|
||||
switch server.connectionType
|
||||
{
|
||||
case .local: self.connectToLocalServer(completion: finish(_:))
|
||||
case .local: self.connectToLocalServer(server, completion: finish(_:))
|
||||
case .wired:
|
||||
guard let incomingConnectionsSemaphore = self.incomingConnectionsSemaphore else { return finish(.failure(ALTServerError(.connectionFailed))) }
|
||||
|
||||
@@ -190,14 +190,18 @@ private extension ServerManager
|
||||
connection.start(queue: self.dispatchQueue)
|
||||
}
|
||||
|
||||
func connectToLocalServer(completion: @escaping (Result<Connection, Error>) -> Void)
|
||||
func connectToLocalServer(_ server: Server, completion: @escaping (Result<Connection, Error>) -> Void)
|
||||
{
|
||||
let connection = XPCConnection()
|
||||
guard let machServiceName = server.machServiceName else { return completion(.failure(ConnectionError.connectionFailed)) }
|
||||
|
||||
let xpcConnection = NSXPCConnection.makeConnection(machServiceName: machServiceName)
|
||||
|
||||
let connection = XPCConnection(xpcConnection)
|
||||
connection.connect { (result) in
|
||||
switch result
|
||||
{
|
||||
case .failure(let error):
|
||||
print("Could not connect to AltDaemon XPC service.", error)
|
||||
print("Could not connect to AltDaemon XPC service \(machServiceName).", error)
|
||||
completion(.failure(error))
|
||||
|
||||
case .success: completion(.success(connection))
|
||||
|
||||
Reference in New Issue
Block a user