Show
Ignore:
Timestamp:
22/07/08 22:31:41 (4 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1216758701 +0200
git-parent:

[bc19641ab140e8b4c6d28428b4f12f57d93b7cee]

git-author:
Laurent Aimar <fenrir@videolan.org> 1216758647 +0200
Message:

Check for file size change at every read (improve reading of downloading
files).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/mmap.c

    r3561b9b r7a2cfda  
    164164    access_sys_t *p_sys = p_access->p_sys; 
    165165 
     166    /* Check if file size changed... */ 
     167    struct stat st; 
     168 
     169    if ((fstat (p_sys->fd, &st) == 0) 
     170     && (st.st_size != p_access->info.i_size)) 
     171    { 
     172        p_access->info.i_size = st.st_size; 
     173        p_access->info.i_update |= INPUT_UPDATE_SIZE; 
     174    } 
     175 
    166176    if ((uint64_t)p_access->info.i_pos >= (uint64_t)p_access->info.i_size) 
    167177    { 
    168         /* End of file - check if file size changed... */ 
    169         struct stat st; 
    170  
    171         if ((fstat (p_sys->fd, &st) == 0) 
    172          && (st.st_size != p_access->info.i_size)) 
    173         { 
    174             p_access->info.i_size = st.st_size; 
    175             p_access->info.i_update |= INPUT_UPDATE_SIZE; 
    176         } 
    177  
    178         /* Really at end of file then */ 
    179         if ((uint64_t)p_access->info.i_pos >= (uint64_t)p_access->info.i_size) 
    180         { 
    181             p_access->info.b_eof = true; 
    182             msg_Dbg (p_access, "at end of memory mapped file"); 
    183             return NULL; 
    184         } 
     178        /* We are at end of file */ 
     179        p_access->info.b_eof = true; 
     180        msg_Dbg (p_access, "at end of memory mapped file"); 
     181        return NULL; 
    185182    } 
    186183