lib/nfs/Connection: broadcast error before closing connection

During the NfsLease::OnNfsConnectionFailed() call, the old (defunct)
nfs_context may be used to close file handles.  Such code does not yet
exist, but will be added soon to fix other bugs.
This commit is contained in:
Max Kellermann 2014-11-25 13:27:06 +01:00
parent f5f43db2da
commit b293b16007

View File

@ -409,10 +409,10 @@ NfsConnection::OnSocketReady(unsigned flags)
error.Format(nfs_domain, "NFS connection has failed: %s", error.Format(nfs_domain, "NFS connection has failed: %s",
nfs_get_error(context)); nfs_get_error(context));
BroadcastError(std::move(error));
DestroyContext(); DestroyContext();
closed = true; closed = true;
BroadcastError(std::move(error));
} else if (SocketMonitor::IsDefined() && nfs_get_fd(context) < 0) { } else if (SocketMonitor::IsDefined() && nfs_get_fd(context) < 0) {
/* this happens when rpc_reconnect_requeue() is called /* this happens when rpc_reconnect_requeue() is called
after the connection broke, but autoreconnet was after the connection broke, but autoreconnet was
@ -425,10 +425,10 @@ NfsConnection::OnSocketReady(unsigned flags)
error.Format(nfs_domain, error.Format(nfs_domain,
"NFS socket disappeared: %s", msg); "NFS socket disappeared: %s", msg);
BroadcastError(std::move(error));
DestroyContext(); DestroyContext();
closed = true; closed = true;
BroadcastError(std::move(error));
} }
assert(in_event); assert(in_event);