lib/nfs/FileReader: move code to CancelOrClose()
This commit is contained in:
parent
38f19981b2
commit
016063c810
@ -56,8 +56,18 @@ NfsFileReader::Close()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this cancels State::MOUNT */
|
||||||
connection->RemoveLease(*this);
|
connection->RemoveLease(*this);
|
||||||
|
|
||||||
|
CancelOrClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NfsFileReader::CancelOrClose()
|
||||||
|
{
|
||||||
|
assert(state != State::INITIAL &&
|
||||||
|
state != State::DEFER);
|
||||||
|
|
||||||
if (state == State::IDLE)
|
if (state == State::IDLE)
|
||||||
/* no async operation in progress: can close
|
/* no async operation in progress: can close
|
||||||
immediately */
|
immediately */
|
||||||
|
@ -76,6 +76,12 @@ protected:
|
|||||||
virtual void OnNfsFileError(Error &&error) = 0;
|
virtual void OnNfsFileError(Error &&error) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* Cancel the current operation, if any. The NfsLease must be
|
||||||
|
* unregistered already.
|
||||||
|
*/
|
||||||
|
void CancelOrClose();
|
||||||
|
|
||||||
void OpenCallback(nfsfh *_fh);
|
void OpenCallback(nfsfh *_fh);
|
||||||
void StatCallback(const struct stat *st);
|
void StatCallback(const struct stat *st);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user