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
7ae57a35
Commit
7ae57a35
authored
Aug 29, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/MultiSocketMonitor: migrate from TimeoutMonitor to TimerEvent
parent
11f36c0b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
MultiSocketMonitor.cxx
src/event/MultiSocketMonitor.cxx
+5
-4
MultiSocketMonitor.hxx
src/event/MultiSocketMonitor.hxx
+5
-3
No files found.
src/event/MultiSocketMonitor.cxx
View file @
7ae57a35
...
...
@@ -28,7 +28,8 @@
#endif
MultiSocketMonitor
::
MultiSocketMonitor
(
EventLoop
&
_loop
)
:
IdleMonitor
(
_loop
),
TimeoutMonitor
(
_loop
)
{
:
IdleMonitor
(
_loop
),
timeout_event
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
))
{
}
void
...
...
@@ -38,7 +39,7 @@ MultiSocketMonitor::Reset()
fds
.
clear
();
IdleMonitor
::
Cancel
();
TimeoutMonitor
::
Cancel
();
timeout_event
.
Cancel
();
ready
=
refresh
=
false
;
}
...
...
@@ -81,9 +82,9 @@ MultiSocketMonitor::Prepare()
{
const
auto
timeout
=
PrepareSockets
();
if
(
timeout
>=
timeout
.
zero
())
TimeoutMonitor
::
Schedule
(
timeout
);
timeout_event
.
Schedule
(
timeout
);
else
TimeoutMonitor
::
Cancel
();
timeout_event
.
Cancel
();
}
...
...
src/event/MultiSocketMonitor.hxx
View file @
7ae57a35
...
...
@@ -22,7 +22,7 @@
#include "check.h"
#include "IdleMonitor.hxx"
#include "Time
outMonitor
.hxx"
#include "Time
rEvent
.hxx"
#include "SocketMonitor.hxx"
#include "Compiler.h"
...
...
@@ -51,7 +51,7 @@ class EventLoop;
* In PrepareSockets(), use UpdateSocketList() and AddSocket().
* DispatchSockets() will be called if at least one socket is ready.
*/
class
MultiSocketMonitor
:
IdleMonitor
,
TimeoutMonitor
class
MultiSocketMonitor
:
IdleMonitor
{
class
SingleFD
final
:
public
SocketMonitor
{
MultiSocketMonitor
&
multi
;
...
...
@@ -97,6 +97,8 @@ class MultiSocketMonitor : IdleMonitor, TimeoutMonitor
friend
class
SingleFD
;
TimerEvent
timeout_event
;
/**
* DispatchSockets() should be called.
*/
...
...
@@ -224,7 +226,7 @@ private:
void
Prepare
();
v
irtual
void
OnTimeout
()
final
{
v
oid
OnTimeout
()
{
SetReady
();
IdleMonitor
::
Schedule
();
}
...
...
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