Commit 15938916 authored by Max Kellermann's avatar Max Kellermann

lib/nfs/FileReader: set `state=IDLE` before invoking callback

Fixes assertion failure if the callback fails.
parent 0a92fbc1
...@@ -4,6 +4,8 @@ ver 0.21.23 (not yet released) ...@@ -4,6 +4,8 @@ ver 0.21.23 (not yet released)
* storage * storage
- curl: fix corrupt "href" values in the presence of XML entities - curl: fix corrupt "href" values in the presence of XML entities
- curl: unescape "href" values - curl: unescape "href" values
* input
- nfs: fix crash bug
* decoder * decoder
- gme: adapt to API change in the upcoming version 0.7.0 - gme: adapt to API change in the upcoming version 0.7.0
* output * output
......
...@@ -186,6 +186,8 @@ NfsFileReader::OpenCallback(nfsfh *_fh) noexcept ...@@ -186,6 +186,8 @@ NfsFileReader::OpenCallback(nfsfh *_fh) noexcept
fh = _fh; fh = _fh;
state = State::IDLE;
try { try {
connection->Stat(fh, *this); connection->Stat(fh, *this);
} catch (...) { } catch (...) {
...@@ -204,13 +206,13 @@ NfsFileReader::StatCallback(const struct stat *st) noexcept ...@@ -204,13 +206,13 @@ NfsFileReader::StatCallback(const struct stat *st) noexcept
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;
} }
state = State::IDLE;
OnNfsFileOpen(st->st_size); OnNfsFileOpen(st->st_size);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment