HTTP Reader: Fix opening really tiny files
Tiny files complete fetching within the scope of the open function, so the URL session task would have completed already. Now the function will accept the data, and allow reading it. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
3069a81d85
commit
e0e7274339
|
@ -200,7 +200,7 @@ didCompleteWithError:(NSError *)error{
|
||||||
while (task && !didReceiveResponse)
|
while (task && !didReceiveResponse)
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
||||||
if (!task) return NO;
|
if (!task && !didReceiveResponse) return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,10 @@ didCompleteWithError:(NSError *)error{
|
||||||
|
|
||||||
- (long)read:(void *)buffer amount:(long)amount
|
- (long)read:(void *)buffer amount:(long)amount
|
||||||
{
|
{
|
||||||
if (didComplete)
|
@synchronized (bufferedData) {
|
||||||
return 0;
|
if (didComplete && ![bufferedData length])
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
long totalRead = 0;
|
long totalRead = 0;
|
||||||
long bytesBuffered = 0;
|
long bytesBuffered = 0;
|
||||||
|
|
Loading…
Reference in New Issue