lib/nfs/FileReader: move code to CancelOrClose()
This commit is contained in:
parent
38f19981b2
commit
016063c810
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user