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>
This commit is contained in:
parent
e0a1cf49e7
commit
5550af7e64
1 changed files with 5 additions and 1 deletions
|
@ -594,11 +594,15 @@ static void http_stream_reset(HTTPSource *fp) {
|
|||
|
||||
[NSThread detachNewThreadSelector:@selector(threadEntry:) toTarget:self withObject:nil];
|
||||
|
||||
// Wait for transfer to at least start
|
||||
while(status == STATUS_UNSTARTED) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue