aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/nfs
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-14 15:45:10 +0100
committerMax Kellermann <max@duempel.org>2014-12-14 15:45:10 +0100
commit80f2ba7fca533de38575bdaf737ea89284ed2b7b (patch)
treec2cee39a0641339614129b96e5a17b7fccf4038a /src/lib/nfs
parent32bca6492034eefee1acb5c71a01a0481ba03245 (diff)
downloadmpd-80f2ba7fca533de38575bdaf737ea89284ed2b7b.tar.gz
mpd-80f2ba7fca533de38575bdaf737ea89284ed2b7b.tar.xz
mpd-80f2ba7fca533de38575bdaf737ea89284ed2b7b.zip
lib/nfs/Connection: move code to Service()
Diffstat (limited to 'src/lib/nfs')
-rw-r--r--src/lib/nfs/Connection.cxx35
-rw-r--r--src/lib/nfs/Connection.hxx5
2 files changed, 28 insertions, 12 deletions
diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx
index cae9ff102..48db620be 100644
--- a/src/lib/nfs/Connection.cxx
+++ b/src/lib/nfs/Connection.cxx
@@ -404,20 +404,11 @@ NfsConnection::ScheduleSocket()
SocketMonitor::Schedule(libnfs_to_events(nfs_which_events(context)));
}
-bool
-NfsConnection::OnSocketReady(unsigned flags)
+inline int
+NfsConnection::Service(unsigned flags)
{
assert(GetEventLoop().IsInside());
- assert(deferred_close.empty());
-
- bool closed = false;
-
- const bool was_mounted = mount_finished;
- if (!mount_finished)
- /* until the mount is finished, the NFS client may use
- various sockets, therefore we unregister and
- re-register it each time */
- SocketMonitor::Steal();
+ assert(context != nullptr);
#ifndef NDEBUG
assert(!in_event);
@@ -435,6 +426,26 @@ NfsConnection::OnSocketReady(unsigned flags)
in_service = false;
#endif
+ return result;
+}
+
+bool
+NfsConnection::OnSocketReady(unsigned flags)
+{
+ assert(GetEventLoop().IsInside());
+ assert(deferred_close.empty());
+
+ bool closed = false;
+
+ const bool was_mounted = mount_finished;
+ if (!mount_finished)
+ /* until the mount is finished, the NFS client may use
+ various sockets, therefore we unregister and
+ re-register it each time */
+ SocketMonitor::Steal();
+
+ const int result = Service(flags);
+
while (!deferred_close.empty()) {
InternalClose(deferred_close.front());
deferred_close.pop_front();
diff --git a/src/lib/nfs/Connection.hxx b/src/lib/nfs/Connection.hxx
index 93bb4e236..3d872eb3a 100644
--- a/src/lib/nfs/Connection.hxx
+++ b/src/lib/nfs/Connection.hxx
@@ -207,6 +207,11 @@ private:
void ScheduleSocket();
+ /**
+ * Wrapper for nfs_service().
+ */
+ int Service(unsigned flags);
+
/* virtual methods from SocketMonitor */
virtual bool OnSocketReady(unsigned flags) override;