Changeset 0b2ea3de7ef423f322aa569a956bbe404cbaed99

Show
Ignore:
Timestamp:
06/25/08 22:44:53 (2 months ago)
Author:
Rémi Duraffort <ivoire@videolan.org>
git-committer:
Rémi Duraffort <ivoire@videolan.org> 1214426693 +0200
git-parent:

[6f25cb79f46b9c5e6069beba37abbd2b4e4efd06]

git-author:
Rémi Duraffort <ivoire@videolan.org> 1214423660 +0200
Message:

Fix the update system, based on funman patch + some modifications.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/update.c

    r57c3ecd r0b2ea3d  
    10501050    p_update->release.psz_desc = NULL; 
    10511051 
     1052    p_update->p_download = NULL; 
     1053    p_update->p_check = NULL; 
     1054 
    10521055    p_update->p_pkey = NULL; 
    10531056    vlc_gcrypt_init(); 
     
    10661069    assert( p_update ); 
    10671070 
     1071    vlc_mutex_lock( &p_update->lock ); 
     1072 
     1073    if( p_update->p_check ) 
     1074    { 
     1075        assert( !p_update->p_download ); 
     1076        vlc_object_kill( p_update->p_check ); 
     1077        vlc_thread_join( p_update->p_check ); 
     1078    } 
     1079    else if( p_update->p_download ) 
     1080    { 
     1081        vlc_object_kill( p_update->p_download ); 
     1082        vlc_thread_join( p_update->p_download ); 
     1083    } 
     1084 
     1085    vlc_mutex_unlock( &p_update->lock ); 
    10681086    vlc_mutex_destroy( &p_update->lock ); 
    10691087 
     
    13371355} 
    13381356 
    1339  
    1340 /** 
    1341  * Struct to launch the check in an other thread 
    1342  */ 
    1343 typedef struct 
    1344 
    1345     VLC_COMMON_MEMBERS 
    1346     update_t *p_update; 
    1347     void (*pf_callback)( void *, bool ); 
    1348     void *p_data; 
    1349 } update_check_thread_t; 
    1350  
    1351 void update_CheckReal( update_check_thread_t *p_uct ); 
     1357static void update_CheckReal( update_check_thread_t *p_uct ); 
    13521358 
    13531359/** 
     
    13681374 
    13691375    p_uct->p_update = p_update; 
     1376    p_update->p_check = p_uct; 
    13701377    p_uct->pf_callback = pf_callback; 
    13711378    p_uct->p_data = p_data; 
     
    13861393    if( p_uct->pf_callback ) 
    13871394        (p_uct->pf_callback)( p_uct->p_data, b_ret ); 
     1395 
     1396    p_uct->p_update->p_check = NULL; 
     1397 
     1398    vlc_object_release( p_uct ); 
    13881399} 
    13891400 
     
    14261437} 
    14271438 
    1428  
    1429 /** 
    1430  * Struct to launch the download in a thread 
    1431  */ 
    1432 typedef struct 
    1433 
    1434     VLC_COMMON_MEMBERS 
    1435     update_t *p_update; 
    1436     char *psz_destdir; 
    1437 } update_download_thread_t; 
    1438  
    1439 void update_DownloadReal( update_download_thread_t *p_udt ); 
     1439static void update_DownloadReal( update_download_thread_t *p_udt ); 
    14401440 
    14411441/** 
     
    14561456 
    14571457    p_udt->p_update = p_update; 
     1458    p_update->p_download = p_udt; 
    14581459    p_udt->psz_destdir = psz_destdir ? strdup( psz_destdir ) : NULL; 
    14591460 
     
    14621463} 
    14631464 
    1464 void update_DownloadReal( update_download_thread_t *p_udt ) 
     1465static void update_DownloadReal( update_download_thread_t *p_udt ) 
    14651466{ 
    14661467    int i_progress = 0; 
     
    16531654    free( p_buffer ); 
    16541655    free( psz_size ); 
     1656 
     1657    p_udt->p_update->p_download = NULL; 
     1658 
     1659    vlc_object_release( p_udt ); 
    16551660} 
    16561661 
  • src/misc/update.h

    r6d9fde8 r0b2ea3d  
    144144 
    145145/** 
     146 * Non blocking binary download 
     147 */ 
     148typedef struct 
     149{ 
     150    VLC_COMMON_MEMBERS 
     151    update_t *p_update; 
     152    char *psz_destdir; 
     153} update_download_thread_t; 
     154 
     155/** 
     156 * Non blocking update availability verification 
     157 */ 
     158typedef struct 
     159{ 
     160    VLC_COMMON_MEMBERS 
     161    update_t *p_update; 
     162    void (*pf_callback)( void *, bool ); 
     163    void *p_data; 
     164} update_check_thread_t; 
     165/** 
    146166 * The update object. Stores (and caches) all information relative to updates 
    147167 */ 
     
    152172    struct update_release_t release;    ///< Release (version) 
    153173    public_key_t *p_pkey; 
     174    update_download_thread_t *p_download; 
     175    update_check_thread_t *p_check; 
    154176}; 
    155177