nfs/Connection: check for disappearing libnfs socket

This commit is contained in:
Max Kellermann 2014-08-31 19:24:38 +02:00
parent 6d643f92b7
commit 43da1686da

View File

@ -299,6 +299,24 @@ NfsConnection::OnSocketReady(unsigned flags)
DestroyContext(); DestroyContext();
closed = true; 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)); BroadcastError(std::move(error));
} }