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
fd520eee
Commit
fd520eee
authored
Aug 29, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Client: migrate from TimeoutMonitor to TimerEvent
parent
30a5dd26
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
10 deletions
+12
-10
Client.hxx
src/client/Client.hxx
+6
-4
ClientExpire.cxx
src/client/ClientExpire.cxx
+1
-1
ClientIdle.cxx
src/client/ClientIdle.cxx
+2
-2
ClientNew.cxx
src/client/ClientNew.cxx
+2
-2
ClientRead.cxx
src/client/ClientRead.cxx
+1
-1
No files found.
src/client/Client.hxx
View file @
fd520eee
...
...
@@ -25,7 +25,7 @@
#include "command/CommandListBuilder.hxx"
#include "tag/Mask.hxx"
#include "event/FullyBufferedSocket.hxx"
#include "event/Time
outMonitor
.hxx"
#include "event/Time
rEvent
.hxx"
#include "Compiler.h"
#include <boost/intrusive/link_mode.hpp>
...
...
@@ -49,8 +49,10 @@ class Database;
class
Storage
;
class
Client
final
:
FullyBufferedSocket
,
TimeoutMonitor
,
:
FullyBufferedSocket
,
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
normal_link
>>
{
TimerEvent
timeout_event
;
Partition
*
partition
;
public
:
...
...
@@ -228,8 +230,8 @@ private:
void
OnSocketError
(
std
::
exception_ptr
ep
)
override
;
void
OnSocketClosed
()
override
;
/*
virtual methods from class TimeoutMonitor
*/
void
OnTimeout
()
override
;
/*
callback for TimerEvent
*/
void
OnTimeout
();
};
void
...
...
src/client/ClientExpire.cxx
View file @
fd520eee
...
...
@@ -28,7 +28,7 @@ Client::SetExpired()
return
;
FullyBufferedSocket
::
Close
();
TimeoutMonitor
::
Schedule
(
std
::
chrono
::
steady_clock
::
duration
::
zero
());
timeout_event
.
Schedule
(
std
::
chrono
::
steady_clock
::
duration
::
zero
());
}
void
...
...
src/client/ClientIdle.cxx
View file @
fd520eee
...
...
@@ -42,7 +42,7 @@ Client::IdleNotify()
Write
(
"OK
\n
"
);
TimeoutMonitor
::
Schedule
(
client_timeout
);
timeout_event
.
Schedule
(
client_timeout
);
}
void
...
...
@@ -69,7 +69,7 @@ Client::IdleWait(unsigned flags)
return
true
;
}
else
{
/* disable timeouts while in "idle" */
TimeoutMonitor
::
Cancel
();
timeout_event
.
Cancel
();
return
false
;
}
}
src/client/ClientNew.cxx
View file @
fd520eee
...
...
@@ -45,13 +45,13 @@ Client::Client(EventLoop &_loop, Partition &_partition,
UniqueSocketDescriptor
&&
_fd
,
int
_uid
,
int
_num
)
:
FullyBufferedSocket
(
_fd
.
Release
(),
_loop
,
16384
,
client_max_output_buffer_size
),
TimeoutMonitor
(
_loop
),
timeout_event
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
)
),
partition
(
&
_partition
),
permission
(
getDefaultPermissions
()),
uid
(
_uid
),
num
(
_num
)
{
TimeoutMonitor
::
Schedule
(
client_timeout
);
timeout_event
.
Schedule
(
client_timeout
);
}
void
...
...
src/client/ClientRead.cxx
View file @
fd520eee
...
...
@@ -34,7 +34,7 @@ Client::OnSocketInput(void *data, size_t length)
if
(
newline
==
nullptr
)
return
InputResult
::
MORE
;
TimeoutMonitor
::
Schedule
(
client_timeout
);
timeout_event
.
Schedule
(
client_timeout
);
BufferedSocket
::
ConsumeInput
(
newline
+
1
-
p
);
...
...
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