lib/nfs/Connection: return from OnSocketReady() after error

This commit is contained in:
Max Kellermann 2024-05-06 18:20:06 +02:00
parent 48fe8666c9
commit 4139024b3d

View File

@ -499,6 +499,7 @@ NfsConnection::OnSocketReady(unsigned flags) noexcept
if (postponed_mount_error) { if (postponed_mount_error) {
PrepareDestroyContext(); PrepareDestroyContext();
BroadcastMountError(std::move(postponed_mount_error)); BroadcastMountError(std::move(postponed_mount_error));
return;
} else if (result == 0) } else if (result == 0)
BroadcastMountSuccess(); BroadcastMountSuccess();
} else if (result < 0) { } else if (result < 0) {
@ -508,6 +509,7 @@ NfsConnection::OnSocketReady(unsigned flags) noexcept
BroadcastError(std::make_exception_ptr(e)); BroadcastError(std::make_exception_ptr(e));
PrepareDestroyContext(); PrepareDestroyContext();
return;
} else if (nfs_get_fd(context) < 0) { } else if (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 autoreconnect was after the connection broke, but autoreconnect was
@ -518,9 +520,11 @@ NfsConnection::OnSocketReady(unsigned flags) noexcept
BroadcastError(std::make_exception_ptr(e)); BroadcastError(std::make_exception_ptr(e));
PrepareDestroyContext(); PrepareDestroyContext();
return;
} }
assert(context == nullptr || nfs_get_fd(context) >= 0); assert(context != nullptr);
assert(nfs_get_fd(context) >= 0);
#ifndef NDEBUG #ifndef NDEBUG
assert(in_event); assert(in_event);