stop the background download thread from pre-fetching beyond EOF
This commit is contained in:
parent
eb463478a8
commit
4c0b7da34b
|
@ -1013,11 +1013,9 @@ long Cache_read(Cache *cf, char * const output_buf, const off_t len,
|
||||||
bgdl:
|
bgdl:
|
||||||
;
|
;
|
||||||
off_t next_dl_offset = round_div(offset_start, cf->blksz) * cf->blksz;
|
off_t next_dl_offset = round_div(offset_start, cf->blksz) * cf->blksz;
|
||||||
// printf("offset_start: %ld, next_dl_offset: %ld, dl_offset: %ld, next_seg_exists: %d, content_length :%ld\n",
|
|
||||||
// offset_start, next_dl_offset, dl_offset, Seg_exist(cf, next_dl_offset), cf->content_length);
|
|
||||||
if ( (next_dl_offset > dl_offset) &&
|
if ( (next_dl_offset > dl_offset) &&
|
||||||
!Seg_exist(cf, next_dl_offset) &&
|
!Seg_exist(cf, next_dl_offset) &&
|
||||||
cf->next_dl_offset < cf->content_length ){
|
next_dl_offset < cf->content_length ){
|
||||||
/* Stop the spawning of multiple background pthreads */
|
/* Stop the spawning of multiple background pthreads */
|
||||||
if(!pthread_mutex_trylock(&cf->bgt_lock)) {
|
if(!pthread_mutex_trylock(&cf->bgt_lock)) {
|
||||||
#ifdef CACHE_LOCK_DEBUG
|
#ifdef CACHE_LOCK_DEBUG
|
||||||
|
|
Loading…
Reference in New Issue