Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
712e3eb1
Commit
712e3eb1
authored
Apr 04, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl: use g_source_get_time()
g_source_get_current_time() is deprecated since GLib 2.28. This patch adds a compatibility wrapper for older GLib versions to glib_compat.h.
parent
a2b5db00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
glib_compat.h
src/glib_compat.h
+12
-0
curl_input_plugin.c
src/input/curl_input_plugin.c
+5
-12
No files found.
src/glib_compat.h
View file @
712e3eb1
...
...
@@ -97,4 +97,16 @@ g_set_error_literal(GError **err, GQuark domain, gint code,
#endif
#if !GLIB_CHECK_VERSION(2,28,0)
static
inline
gint64
g_source_get_time
(
GSource
*
source
)
{
GTimeVal
tv
;
g_source_get_current_time
(
source
,
&
tv
);
return
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
}
#endif
#endif
src/input/curl_input_plugin.c
View file @
712e3eb1
...
...
@@ -161,7 +161,7 @@ static struct {
* The absolute time stamp when the timeout expires. This is
* used in the GSource method check().
*/
GTimeVal
absolute_timeout
;
gint64
absolute_timeout
;
#endif
}
curl
;
...
...
@@ -551,12 +551,9 @@ input_curl_source_prepare(G_GNUC_UNUSED GSource *source, gint *timeout_r)
long
timeout2
;
CURLMcode
mcode
=
curl_multi_timeout
(
curl
.
multi
,
&
timeout2
);
if
(
mcode
==
CURLM_OK
)
{
if
(
timeout2
>=
0
)
{
g_source_get_current_time
(
source
,
&
curl
.
absolute_timeout
);
g_time_val_add
(
&
curl
.
absolute_timeout
,
timeout2
*
1000
);
}
if
(
timeout2
>=
0
)
curl
.
absolute_timeout
=
g_source_get_time
(
source
)
+
timeout2
*
1000
;
if
(
timeout2
>=
0
&&
timeout2
<
10
)
/* CURL 7.21.1 likes to report "timeout=0",
...
...
@@ -590,11 +587,7 @@ input_curl_source_check(G_GNUC_UNUSED GSource *source)
curl_multi_perform(), even if there was no file
descriptor event */
GTimeVal
now
;
g_source_get_current_time
(
source
,
&
now
);
if
(
now
.
tv_sec
>
curl
.
absolute_timeout
.
tv_sec
||
(
now
.
tv_sec
==
curl
.
absolute_timeout
.
tv_sec
&&
now
.
tv_usec
>=
curl
.
absolute_timeout
.
tv_usec
))
if
(
g_source_get_time
(
source
)
>=
curl
.
absolute_timeout
)
return
true
;
}
#endif
...
...
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