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
e53a4d0a
Commit
e53a4d0a
authored
Apr 23, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/nfs/FileReader: reset `state` in OnNfsCallback()
The object's state is `IDLE` when OnNfsCallback() gets invoked, so let's use the start of the method to reset the `state` field.
parent
15938916
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
FileReader.cxx
src/lib/nfs/FileReader.cxx
+1
-8
No files found.
src/lib/nfs/FileReader.cxx
View file @
e53a4d0a
...
@@ -180,14 +180,11 @@ NfsFileReader::OnNfsConnectionDisconnected(std::exception_ptr e) noexcept
...
@@ -180,14 +180,11 @@ NfsFileReader::OnNfsConnectionDisconnected(std::exception_ptr e) noexcept
inline
void
inline
void
NfsFileReader
::
OpenCallback
(
nfsfh
*
_fh
)
noexcept
NfsFileReader
::
OpenCallback
(
nfsfh
*
_fh
)
noexcept
{
{
assert
(
state
==
State
::
OPEN
);
assert
(
connection
!=
nullptr
);
assert
(
connection
!=
nullptr
);
assert
(
_fh
!=
nullptr
);
assert
(
_fh
!=
nullptr
);
fh
=
_fh
;
fh
=
_fh
;
state
=
State
::
IDLE
;
try
{
try
{
connection
->
Stat
(
fh
,
*
this
);
connection
->
Stat
(
fh
,
*
this
);
}
catch
(...)
{
}
catch
(...)
{
...
@@ -201,13 +198,10 @@ NfsFileReader::OpenCallback(nfsfh *_fh) noexcept
...
@@ -201,13 +198,10 @@ NfsFileReader::OpenCallback(nfsfh *_fh) noexcept
inline
void
inline
void
NfsFileReader
::
StatCallback
(
const
struct
stat
*
st
)
noexcept
NfsFileReader
::
StatCallback
(
const
struct
stat
*
st
)
noexcept
{
{
assert
(
state
==
State
::
STAT
);
assert
(
connection
!=
nullptr
);
assert
(
connection
!=
nullptr
);
assert
(
fh
!=
nullptr
);
assert
(
fh
!=
nullptr
);
assert
(
st
!=
nullptr
);
assert
(
st
!=
nullptr
);
state
=
State
::
IDLE
;
if
(
!
S_ISREG
(
st
->
st_mode
))
{
if
(
!
S_ISREG
(
st
->
st_mode
))
{
OnNfsFileError
(
std
::
make_exception_ptr
(
std
::
runtime_error
(
"Not a regular file"
)));
OnNfsFileError
(
std
::
make_exception_ptr
(
std
::
runtime_error
(
"Not a regular file"
)));
return
;
return
;
...
@@ -219,7 +213,7 @@ NfsFileReader::StatCallback(const struct stat *st) noexcept
...
@@ -219,7 +213,7 @@ NfsFileReader::StatCallback(const struct stat *st) noexcept
void
void
NfsFileReader
::
OnNfsCallback
(
unsigned
status
,
void
*
data
)
noexcept
NfsFileReader
::
OnNfsCallback
(
unsigned
status
,
void
*
data
)
noexcept
{
{
switch
(
st
ate
)
{
switch
(
st
d
::
exchange
(
state
,
State
::
IDLE
)
)
{
case
State
:
:
INITIAL
:
case
State
:
:
INITIAL
:
case
State
:
:
DEFER
:
case
State
:
:
DEFER
:
case
State
:
:
MOUNT
:
case
State
:
:
MOUNT
:
...
@@ -236,7 +230,6 @@ NfsFileReader::OnNfsCallback(unsigned status, void *data) noexcept
...
@@ -236,7 +230,6 @@ NfsFileReader::OnNfsCallback(unsigned status, void *data) noexcept
break
;
break
;
case
State
:
:
READ
:
case
State
:
:
READ
:
state
=
State
::
IDLE
;
OnNfsFileRead
(
data
,
status
);
OnNfsFileRead
(
data
,
status
);
break
;
break
;
}
}
...
...
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