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
11f36c0b
Commit
11f36c0b
authored
Aug 29, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zeroconf/AvahiPoll: migrate from TimeoutMonitor to TimerEvent
parent
fd520eee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
AvahiPoll.cxx
src/zeroconf/AvahiPoll.cxx
+10
-9
No files found.
src/zeroconf/AvahiPoll.cxx
View file @
11f36c0b
...
...
@@ -20,7 +20,7 @@
#include "config.h"
#include "AvahiPoll.hxx"
#include "event/SocketMonitor.hxx"
#include "event/Time
outMonitor
.hxx"
#include "event/Time
rEvent
.hxx"
static
unsigned
FromAvahiWatchEvent
(
AvahiWatchEvent
e
)
...
...
@@ -84,8 +84,9 @@ TimevalToChrono(const timeval &tv)
return
std
::
chrono
::
seconds
(
tv
.
tv_sec
)
+
std
::
chrono
::
microseconds
(
tv
.
tv_usec
);
}
struct
AvahiTimeout
final
:
private
TimeoutMonitor
{
private
:
struct
AvahiTimeout
final
{
TimerEvent
timer
;
const
AvahiTimeoutCallback
callback
;
void
*
const
userdata
;
...
...
@@ -93,25 +94,25 @@ public:
AvahiTimeout
(
const
struct
timeval
*
tv
,
AvahiTimeoutCallback
_callback
,
void
*
_userdata
,
EventLoop
&
_loop
)
:
TimeoutMonitor
(
_loop
),
:
timer
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
)
),
callback
(
_callback
),
userdata
(
_userdata
)
{
if
(
tv
!=
nullptr
)
Schedule
(
TimevalToChrono
(
*
tv
));
timer
.
Schedule
(
TimevalToChrono
(
*
tv
));
}
static
void
TimeoutUpdate
(
AvahiTimeout
*
t
,
const
struct
timeval
*
tv
)
{
if
(
tv
!=
nullptr
)
t
->
Schedule
(
TimevalToChrono
(
*
tv
));
t
->
timer
.
Schedule
(
TimevalToChrono
(
*
tv
));
else
t
->
Cancel
();
t
->
timer
.
Cancel
();
}
static
void
TimeoutFree
(
AvahiTimeout
*
t
)
{
delete
t
;
}
pr
otected
:
v
irtual
v
oid
OnTimeout
()
{
pr
ivate
:
void
OnTimeout
()
{
callback
(
this
,
userdata
);
}
};
...
...
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