aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-31 19:24:38 +0200
committerMax Kellermann <max@duempel.org>2014-08-31 19:33:08 +0200
commit43da1686da1dce765d26629d114bf7711905aa8c (patch)
tree714bf36b02712688ac8d1dd9d983c5571d6d596c /src/lib
parent6d643f92b7b52170cb83e068d41c07467be793cc (diff)
downloadmpd-43da1686da1dce765d26629d114bf7711905aa8c.tar.gz
mpd-43da1686da1dce765d26629d114bf7711905aa8c.tar.xz
mpd-43da1686da1dce765d26629d114bf7711905aa8c.zip
nfs/Connection: check for disappearing libnfs socket
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/nfs/Connection.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx
index 64458fec6..d37817a86 100644
--- a/src/lib/nfs/Connection.cxx
+++ b/src/lib/nfs/Connection.cxx
@@ -300,6 +300,24 @@ NfsConnection::OnSocketReady(unsigned flags)
closed = true;
BroadcastError(std::move(error));
+ } else if (SocketMonitor::IsDefined() && nfs_get_fd(context) < 0) {
+ /* this happens when rpc_reconnect_requeue() is called
+ after the connection broke, but autoreconnet was
+ disabled - nfs_service() returns 0 */
+ Error error;
+ const char *msg = nfs_get_error(context);
+ if (msg == nullptr)
+ error.Set(nfs_domain, "NFS socket disappeared");
+ else
+ error.Format(nfs_domain,
+ "NFS socket disappeared: %s", msg);
+
+ const ScopeLock protect(mutex);
+
+ DestroyContext();
+ closed = true;
+
+ BroadcastError(std::move(error));
}
assert(in_event);