diff options
author | Max Kellermann <max@duempel.org> | 2014-11-25 13:03:09 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-11-25 13:39:42 +0100 |
commit | 40dd968f1302da9fa65c53ba0ae0e6a12c7cda9b (patch) | |
tree | 69e2f87c3bc5cd56bb9f31fe9b0ae96fe35afa59 | |
parent | 3cef348f30ad8a018b1c46f257d3e719be3f96b0 (diff) | |
download | mpd-40dd968f1302da9fa65c53ba0ae0e6a12c7cda9b.tar.gz mpd-40dd968f1302da9fa65c53ba0ae0e6a12c7cda9b.tar.xz mpd-40dd968f1302da9fa65c53ba0ae0e6a12c7cda9b.zip |
lib/nfs/FileReader: update "state" in OnNfsError()
Clean up the "state" to indicate that there is no longer any
asynchronous operation. Fixes another NFS-related crash due to
cleanup of a non-existing asynchronous operation.
Diffstat (limited to '')
-rw-r--r-- | src/lib/nfs/FileReader.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx index 4837e1f0e..7f5506d50 100644 --- a/src/lib/nfs/FileReader.cxx +++ b/src/lib/nfs/FileReader.cxx @@ -246,6 +246,30 @@ NfsFileReader::OnNfsCallback(unsigned status, void *data) void NfsFileReader::OnNfsError(Error &&error) { + switch (state) { + case State::INITIAL: + case State::DEFER: + case State::MOUNT: + case State::IDLE: + assert(false); + gcc_unreachable(); + + case State::OPEN: + connection->RemoveLease(*this); + state = State::INITIAL; + break; + + case State::STAT: + connection->RemoveLease(*this); + connection->Close(fh); + state = State::INITIAL; + break; + + case State::READ: + state = State::IDLE; + break; + } + OnNfsFileError(std::move(error)); } |