HTTP Input: Do not hang if transfer completes
If transfer completes quickly, do not hang waiting for it to achieve reading state. Also add some comments indicating what we're doing. Signed-off-by: Christopher Snowhill <kode54@gmail.com>xcode15
parent
10f22d137c
commit
22cdf0aa4f
|
@ -594,11 +594,15 @@ static void http_stream_reset(HTTPSource *fp) {
|
||||||
|
|
||||||
[NSThread detachNewThreadSelector:@selector(threadEntry:) toTarget:self withObject:nil];
|
[NSThread detachNewThreadSelector:@selector(threadEntry:) toTarget:self withObject:nil];
|
||||||
|
|
||||||
|
// Wait for transfer to at least start
|
||||||
while(status == STATUS_UNSTARTED) {
|
while(status == STATUS_UNSTARTED) {
|
||||||
usleep(3000);
|
usleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(status != STATUS_READING && curl) {
|
// Now wait for it to either begin streaming, or complete if file is small enough to fit in the buffer
|
||||||
|
while(status != STATUS_READING &&
|
||||||
|
status != STATUS_FINISHED &&
|
||||||
|
curl) {
|
||||||
usleep(3000);
|
usleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue