Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
0b2ea3de
Commit
0b2ea3de
authored
Jun 25, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the update system, based on funman patch + some modifications.
parent
6f25cb79
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
26 deletions
+53
-26
src/misc/update.c
src/misc/update.c
+31
-26
src/misc/update.h
src/misc/update.h
+22
-0
No files found.
src/misc/update.c
View file @
0b2ea3de
...
...
@@ -1049,6 +1049,9 @@ update_t *__update_New( vlc_object_t *p_this )
p_update
->
release
.
psz_url
=
NULL
;
p_update
->
release
.
psz_desc
=
NULL
;
p_update
->
p_download
=
NULL
;
p_update
->
p_check
=
NULL
;
p_update
->
p_pkey
=
NULL
;
vlc_gcrypt_init
();
...
...
@@ -1065,6 +1068,21 @@ void update_Delete( update_t *p_update )
{
assert
(
p_update
);
vlc_mutex_lock
(
&
p_update
->
lock
);
if
(
p_update
->
p_check
)
{
assert
(
!
p_update
->
p_download
);
vlc_object_kill
(
p_update
->
p_check
);
vlc_thread_join
(
p_update
->
p_check
);
}
else
if
(
p_update
->
p_download
)
{
vlc_object_kill
(
p_update
->
p_download
);
vlc_thread_join
(
p_update
->
p_download
);
}
vlc_mutex_unlock
(
&
p_update
->
lock
);
vlc_mutex_destroy
(
&
p_update
->
lock
);
free
(
p_update
->
release
.
psz_url
);
...
...
@@ -1336,19 +1354,7 @@ error:
return
false
;
}
/**
* Struct to launch the check in an other thread
*/
typedef
struct
{
VLC_COMMON_MEMBERS
update_t
*
p_update
;
void
(
*
pf_callback
)(
void
*
,
bool
);
void
*
p_data
;
}
update_check_thread_t
;
void
update_CheckReal
(
update_check_thread_t
*
p_uct
);
static
void
update_CheckReal
(
update_check_thread_t
*
p_uct
);
/**
* Check for updates
...
...
@@ -1367,6 +1373,7 @@ void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ), void
if
(
!
p_uct
)
return
;
p_uct
->
p_update
=
p_update
;
p_update
->
p_check
=
p_uct
;
p_uct
->
pf_callback
=
pf_callback
;
p_uct
->
p_data
=
p_data
;
...
...
@@ -1385,6 +1392,10 @@ void update_CheckReal( update_check_thread_t *p_uct )
if
(
p_uct
->
pf_callback
)
(
p_uct
->
pf_callback
)(
p_uct
->
p_data
,
b_ret
);
p_uct
->
p_update
->
p_check
=
NULL
;
vlc_object_release
(
p_uct
);
}
/**
...
...
@@ -1425,18 +1436,7 @@ static char *size_str( long int l_size )
return
i_retval
==
-
1
?
NULL
:
psz_tmp
;
}
/**
* Struct to launch the download in a thread
*/
typedef
struct
{
VLC_COMMON_MEMBERS
update_t
*
p_update
;
char
*
psz_destdir
;
}
update_download_thread_t
;
void
update_DownloadReal
(
update_download_thread_t
*
p_udt
);
static
void
update_DownloadReal
(
update_download_thread_t
*
p_udt
);
/**
* Download the file given in the update_t
...
...
@@ -1455,13 +1455,14 @@ void update_Download( update_t *p_update, const char *psz_destdir )
return
;
p_udt
->
p_update
=
p_update
;
p_update
->
p_download
=
p_udt
;
p_udt
->
psz_destdir
=
psz_destdir
?
strdup
(
psz_destdir
)
:
NULL
;
vlc_thread_create
(
p_udt
,
"download update"
,
update_DownloadReal
,
VLC_THREAD_PRIORITY_LOW
,
false
);
}
void
update_DownloadReal
(
update_download_thread_t
*
p_udt
)
static
void
update_DownloadReal
(
update_download_thread_t
*
p_udt
)
{
int
i_progress
=
0
;
long
int
l_size
;
...
...
@@ -1652,6 +1653,10 @@ end:
free
(
psz_destfile
);
free
(
p_buffer
);
free
(
psz_size
);
p_udt
->
p_update
->
p_download
=
NULL
;
vlc_object_release
(
p_udt
);
}
update_release_t
*
update_GetRelease
(
update_t
*
p_update
)
...
...
src/misc/update.h
View file @
0b2ea3de
...
...
@@ -142,6 +142,26 @@ struct public_key_t
typedef
struct
public_key_t
public_key_t
;
/**
* Non blocking binary download
*/
typedef
struct
{
VLC_COMMON_MEMBERS
update_t
*
p_update
;
char
*
psz_destdir
;
}
update_download_thread_t
;
/**
* Non blocking update availability verification
*/
typedef
struct
{
VLC_COMMON_MEMBERS
update_t
*
p_update
;
void
(
*
pf_callback
)(
void
*
,
bool
);
void
*
p_data
;
}
update_check_thread_t
;
/**
* The update object. Stores (and caches) all information relative to updates
*/
...
...
@@ -151,5 +171,7 @@ struct update_t
vlc_mutex_t
lock
;
struct
update_release_t
release
;
///< Release (version)
public_key_t
*
p_pkey
;
update_download_thread_t
*
p_download
;
update_check_thread_t
*
p_check
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment