Commit 80f2ba7f authored by Max Kellermann's avatar Max Kellermann

lib/nfs/Connection: move code to Service()

parent 32bca649
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment