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
c24b8460
Commit
c24b8460
authored
Aug 29, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/curl/Global: migrate from TimeoutMonitor to TimerEvent
parent
2e471dae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
Global.cxx
src/lib/curl/Global.cxx
+4
-3
Global.hxx
src/lib/curl/Global.hxx
+7
-5
No files found.
src/lib/curl/Global.cxx
View file @
c24b8460
...
...
@@ -96,7 +96,8 @@ private:
};
CurlGlobal
::
CurlGlobal
(
EventLoop
&
_loop
)
:
TimeoutMonitor
(
_loop
),
DeferredMonitor
(
_loop
)
:
DeferredMonitor
(
_loop
),
timeout_event
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
))
{
multi
.
SetOption
(
CURLMOPT_SOCKETFUNCTION
,
CurlSocket
::
SocketFunction
);
multi
.
SetOption
(
CURLMOPT_SOCKETDATA
,
this
);
...
...
@@ -222,7 +223,7 @@ inline void
CurlGlobal
::
UpdateTimeout
(
long
timeout_ms
)
{
if
(
timeout_ms
<
0
)
{
TimeoutMonitor
::
Cancel
();
timeout_event
.
Cancel
();
return
;
}
...
...
@@ -233,7 +234,7 @@ CurlGlobal::UpdateTimeout(long timeout_ms)
of 10ms. */
timeout_ms
=
10
;
TimeoutMonitor
::
Schedule
(
std
::
chrono
::
milliseconds
(
timeout_ms
));
timeout_event
.
Schedule
(
std
::
chrono
::
milliseconds
(
timeout_ms
));
}
int
...
...
src/lib/curl/Global.hxx
View file @
c24b8460
...
...
@@ -31,7 +31,7 @@
#define CURL_GLOBAL_HXX
#include "Multi.hxx"
#include "event/Time
outMonitor
.hxx"
#include "event/Time
rEvent
.hxx"
#include "event/DeferredMonitor.hxx"
class
CurlSocket
;
...
...
@@ -40,13 +40,15 @@ class CurlRequest;
/**
* Manager for the global CURLM object.
*/
class
CurlGlobal
final
:
TimeoutMonitor
,
DeferredMonitor
{
class
CurlGlobal
final
:
DeferredMonitor
{
CurlMulti
multi
;
TimerEvent
timeout_event
;
public
:
explicit
CurlGlobal
(
EventLoop
&
_loop
);
using
Timeout
Monitor
::
GetEventLoop
;
using
Deferred
Monitor
::
GetEventLoop
;
void
Add
(
CURL
*
easy
,
CurlRequest
&
request
);
void
Remove
(
CURL
*
easy
);
...
...
@@ -82,8 +84,8 @@ private:
void
UpdateTimeout
(
long
timeout_ms
);
static
int
TimerFunction
(
CURLM
*
global
,
long
timeout_ms
,
void
*
userp
);
/*
virtual methods from class TimeoutMonitor
*/
void
OnTimeout
()
override
;
/*
callback for #timeout_event
*/
void
OnTimeout
();
/* virtual methods from class DeferredMonitor */
void
RunDeferred
()
override
;
...
...
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