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
91d4b5cf
Commit
91d4b5cf
authored
Aug 29, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/nfs/Connection: migrate from TimeoutMonitor to TimerEvent
parent
c24b8460
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
Connection.cxx
src/lib/nfs/Connection.cxx
+6
-6
Connection.hxx
src/lib/nfs/Connection.hxx
+8
-5
No files found.
src/lib/nfs/Connection.cxx
View file @
91d4b5cf
...
...
@@ -359,8 +359,8 @@ NfsConnection::DestroyContext()
#endif
if
(
!
mount_finished
)
{
assert
(
TimeoutMonitor
::
IsActive
());
TimeoutMonitor
::
Cancel
();
assert
(
mount_timeout_event
.
IsActive
());
mount_timeout_event
.
Cancel
();
}
/* cancel pending DeferredMonitor that was scheduled to notify
...
...
@@ -525,8 +525,8 @@ NfsConnection::MountCallback(int status, gcc_unused nfs_context *nfs,
mount_finished
=
true
;
assert
(
TimeoutMonitor
::
IsActive
()
||
in_destroy
);
TimeoutMonitor
::
Cancel
();
assert
(
mount_timeout_event
.
IsActive
()
||
in_destroy
);
mount_timeout_event
.
Cancel
();
if
(
status
<
0
)
{
auto
e
=
FormatRuntimeError
(
"nfs_mount_async() failed: %s"
,
...
...
@@ -558,7 +558,7 @@ NfsConnection::MountInternal()
postponed_mount_error
=
std
::
exception_ptr
();
mount_finished
=
false
;
TimeoutMonitor
::
Schedule
(
NFS_MOUNT_TIMEOUT
);
mount_timeout_event
.
Schedule
(
NFS_MOUNT_TIMEOUT
);
#ifndef NDEBUG
in_service
=
false
;
...
...
@@ -619,7 +619,7 @@ NfsConnection::BroadcastError(std::exception_ptr &&e)
}
void
NfsConnection
::
OnTimeout
()
NfsConnection
::
On
Mount
Timeout
()
{
assert
(
GetEventLoop
().
IsInside
());
assert
(
!
mount_finished
);
...
...
src/lib/nfs/Connection.hxx
View file @
91d4b5cf
...
...
@@ -22,7 +22,7 @@
#include "Cancellable.hxx"
#include "event/SocketMonitor.hxx"
#include "event/Time
outMonitor
.hxx"
#include "event/Time
rEvent
.hxx"
#include "event/DeferredMonitor.hxx"
#include <string>
...
...
@@ -39,7 +39,7 @@ class NfsLease;
/**
* An asynchronous connection to a NFS server.
*/
class
NfsConnection
:
SocketMonitor
,
TimeoutMonitor
,
DeferredMonitor
{
class
NfsConnection
:
SocketMonitor
,
DeferredMonitor
{
class
CancellableCallback
:
public
CancellablePointer
<
NfsCallback
>
{
NfsConnection
&
connection
;
...
...
@@ -91,6 +91,8 @@ class NfsConnection : SocketMonitor, TimeoutMonitor, DeferredMonitor {
void
Callback
(
int
err
,
void
*
data
);
};
TimerEvent
mount_timeout_event
;
std
::
string
server
,
export_name
;
nfs_context
*
context
;
...
...
@@ -136,8 +138,9 @@ public:
gcc_nonnull_all
NfsConnection
(
EventLoop
&
_loop
,
const
char
*
_server
,
const
char
*
_export_name
)
noexcept
:
SocketMonitor
(
_loop
),
TimeoutMonitor
(
_loop
),
:
SocketMonitor
(
_loop
),
DeferredMonitor
(
_loop
),
mount_timeout_event
(
_loop
,
BIND_THIS_METHOD
(
OnMountTimeout
)),
server
(
_server
),
export_name
(
_export_name
),
context
(
nullptr
)
{}
...
...
@@ -229,8 +232,8 @@ private:
/* virtual methods from SocketMonitor */
virtual
bool
OnSocketReady
(
unsigned
flags
)
override
;
/*
virtual methods from TimeoutMonitor
*/
void
On
Timeout
()
final
;
/*
callback for #mount_timeout_event
*/
void
On
MountTimeout
()
;
/* virtual methods from DeferredMonitor */
virtual
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