mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 14:53:25 +01:00
[AltKit] Gracefully fails if no data is received over network connection
This commit is contained in:
@@ -28,6 +28,10 @@ public class NetworkConnection: NSObject, Connection
|
||||
public func __receiveData(expectedSize: Int, completionHandler: @escaping (Data?, Error?) -> Void)
|
||||
{
|
||||
self.nwConnection.receive(minimumIncompleteLength: expectedSize, maximumLength: expectedSize) { (data, context, isComplete, error) in
|
||||
guard data != nil || error != nil else {
|
||||
return completionHandler(nil, ALTServerError(.lostConnection))
|
||||
}
|
||||
|
||||
completionHandler(data, error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user