From 7fa1a84ec37ba6e891d2eb9d557cf3ddfb902023 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 14 Dec 2014 15:38:09 +0100 Subject: lib/nfs/Connection: move code to method InternalClose() --- src/lib/nfs/Connection.cxx | 15 ++++++++++++--- src/lib/nfs/Connection.hxx | 5 +++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index c62b11acb..433d49ecf 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -331,12 +331,22 @@ DummyCallback(int, struct nfs_context *, void *, void *) { } +inline void +NfsConnection::InternalClose(struct nfsfh *fh) +{ + assert(GetEventLoop().IsInside()); + assert(context != nullptr); + assert(fh != nullptr); + + nfs_close_async(context, fh, DummyCallback, nullptr); +} + void NfsConnection::Close(struct nfsfh *fh) { assert(GetEventLoop().IsInside()); - nfs_close_async(context, fh, DummyCallback, nullptr); + InternalClose(fh); ScheduleSocket(); } @@ -424,8 +434,7 @@ NfsConnection::OnSocketReady(unsigned flags) #endif while (!deferred_close.empty()) { - nfs_close_async(context, deferred_close.front(), - DummyCallback, nullptr); + InternalClose(deferred_close.front()); deferred_close.pop_front(); } diff --git a/src/lib/nfs/Connection.hxx b/src/lib/nfs/Connection.hxx index e63782931..93bb4e236 100644 --- a/src/lib/nfs/Connection.hxx +++ b/src/lib/nfs/Connection.hxx @@ -186,6 +186,11 @@ protected: private: void DestroyContext(); + /** + * Wrapper for nfs_close_async(). + */ + void InternalClose(struct nfsfh *fh); + /** * Invoke nfs_close_async() after nfs_service() returns. */ -- cgit v1.2.3