lib/nfs/FileReader: move code to CancelOrClose()

This commit is contained in:
Max Kellermann 2014-11-25 14:00:32 +01:00
parent 38f19981b2
commit 016063c810
2 changed files with 16 additions and 0 deletions

View File

@ -56,8 +56,18 @@ NfsFileReader::Close()
return;
}
/* this cancels State::MOUNT */
connection->RemoveLease(*this);
CancelOrClose();
}
void
NfsFileReader::CancelOrClose()
{
assert(state != State::INITIAL &&
state != State::DEFER);
if (state == State::IDLE)
/* no async operation in progress: can close
immediately */

View File

@ -76,6 +76,12 @@ protected:
virtual void OnNfsFileError(Error &&error) = 0;
private:
/**
* Cancel the current operation, if any. The NfsLease must be
* unregistered already.
*/
void CancelOrClose();
void OpenCallback(nfsfh *_fh);
void StatCallback(const struct stat *st);