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
a4870492
Commit
a4870492
authored
Dec 14, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage/nfs: add timeout
parent
68d1abdb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
NEWS
NEWS
+2
-0
Blocking.cxx
src/lib/nfs/Blocking.cxx
+6
-1
Blocking.hxx
src/lib/nfs/Blocking.hxx
+7
-2
No files found.
NEWS
View file @
a4870492
...
...
@@ -4,6 +4,8 @@ ver 0.19.7 (not yet released)
- nfs: fix memory leak on connection failure
- nfs: fix reconnect after mount failure
- nfs: implement mount timeout (60 seconds)
* storage
- nfs: implement I/O timeout (60 seconds)
* playlist
- don't skip non-existent songs in "listplaylist"
* fix memory allocator bug on Windows
...
...
src/lib/nfs/Blocking.cxx
View file @
a4870492
...
...
@@ -20,7 +20,9 @@
#include "config.h"
#include "Blocking.hxx"
#include "Connection.hxx"
#include "Domain.hxx"
#include "event/Call.hxx"
#include "util/Error.hxx"
bool
BlockingNfsOperation
::
Run
(
Error
&
_error
)
...
...
@@ -31,7 +33,10 @@ BlockingNfsOperation::Run(Error &_error)
[
this
](){
connection
.
AddLease
(
*
this
);
});
/* wait for completion */
LockWaitFinished
();
if
(
!
LockWaitFinished
())
{
_error
.
Set
(
nfs_domain
,
0
,
"Timeout"
);
return
false
;
}
/* check for error */
if
(
error
.
IsDefined
())
{
...
...
src/lib/nfs/Blocking.hxx
View file @
a4870492
...
...
@@ -35,6 +35,8 @@ class NfsConnection;
* thread, and method Run() waits for completion.
*/
class
BlockingNfsOperation
:
protected
NfsCallback
,
NfsLease
{
static
constexpr
unsigned
timeout_ms
=
60000
;
Mutex
mutex
;
Cond
cond
;
...
...
@@ -52,10 +54,13 @@ public:
bool
Run
(
Error
&
error
);
private
:
void
LockWaitFinished
()
{
bool
LockWaitFinished
()
{
const
ScopeLock
protect
(
mutex
);
while
(
!
finished
)
cond
.
wait
(
mutex
);
if
(
!
cond
.
timed_wait
(
mutex
,
timeout_ms
))
return
false
;
return
true
;
}
/**
...
...
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