diff options
author | Max Kellermann <max@duempel.org> | 2014-08-31 19:24:38 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-31 19:33:08 +0200 |
commit | 43da1686da1dce765d26629d114bf7711905aa8c (patch) | |
tree | 714bf36b02712688ac8d1dd9d983c5571d6d596c | |
parent | 6d643f92b7b52170cb83e068d41c07467be793cc (diff) | |
download | mpd-43da1686da1dce765d26629d114bf7711905aa8c.tar.gz mpd-43da1686da1dce765d26629d114bf7711905aa8c.tar.xz mpd-43da1686da1dce765d26629d114bf7711905aa8c.zip |
nfs/Connection: check for disappearing libnfs socket
-rw-r--r-- | src/lib/nfs/Connection.cxx | 18 |
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); |