mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Attempt to fix data load conditions
This commit is contained in:
@@ -104,7 +104,8 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
||||
var completedRequest = false
|
||||
let disposable = data.start(next: { result in
|
||||
let (data, isComplete) = result
|
||||
if data.count == readCount || isComplete{
|
||||
if data.count == readCount || isComplete {
|
||||
precondition(data.count <= readCount)
|
||||
fetchedData = data
|
||||
completedRequest = true
|
||||
semaphore.signal()
|
||||
@@ -178,6 +179,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
||||
}
|
||||
}
|
||||
if let fetchedData = fetchedData {
|
||||
precondition(fetchedData.count <= readCount)
|
||||
fetchedData.withUnsafeBytes { bytes -> Void in
|
||||
precondition(bytes.baseAddress != nil)
|
||||
memcpy(buffer, bytes.baseAddress, fetchedData.count)
|
||||
|
||||
Reference in New Issue
Block a user