diff options
Diffstat (limited to 'src/lib/nfs/Connection.cxx')
-rw-r--r-- | src/lib/nfs/Connection.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index 48db620be..83b388dc4 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -133,6 +133,17 @@ NfsConnection::CancellableCallback::CancelAndScheduleClose(struct nfsfh *fh) } inline void +NfsConnection::CancellableCallback::PrepareDestroyContext() +{ + assert(IsCancelled()); + + if (close_fh != nullptr) { + connection.InternalClose(close_fh); + close_fh = nullptr; + } +} + +inline void NfsConnection::CancellableCallback::Callback(int err, void *data) { assert(connection.GetEventLoop().IsInside()); @@ -370,6 +381,10 @@ NfsConnection::DestroyContext() if (SocketMonitor::IsDefined()) SocketMonitor::Cancel(); + callbacks.ForEach([](CancellableCallback &c){ + c.PrepareDestroyContext(); + }); + nfs_destroy_context(context); context = nullptr; } |