From 41adf8aea67c4b1bd3b69067e4e12ff6bf06a7d7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 31 Oct 2025 18:25:17 +0000 Subject: Reduce nesting in OnCleanup hooks. --- modules/extra/ssl_openssl.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'modules/extra/ssl_openssl.cpp') diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp index 1f63c24e3..3398e78f4 100644 --- a/modules/extra/ssl_openssl.cpp +++ b/modules/extra/ssl_openssl.cpp @@ -1056,17 +1056,16 @@ public: void OnCleanup(ExtensionType type, Extensible* item) override { - if (type == ExtensionType::USER) - { - LocalUser* user = IS_LOCAL((User*)item); + if (type != ExtensionType::USER) + return; - if (user && user->io->GetSocket() && user->io->GetSocket()->GetModHook(this)) - { - // User is using TLS, they're a local user, and they're using one of *our* TLS ports. - // Potentially there could be multiple TLS modules loaded at once on different ports. - ServerInstance->Users.QuitUser(user, "OpenSSL module unloading"); - } - } + auto* user = IS_LOCAL(static_cast(item)); + if (!user || !user->io->GetSocket() || !user->io->GetSocket()->GetModHook(this)) + return; + + // User is using TLS, they're a local user, and they're using one of *our* TLS ports. + // Potentially there could be multiple TLS modules loaded at once on different ports. + ServerInstance->Users.QuitUser(user, "OpenSSL module unloading"); } ModResult OnCheckReady(LocalUser* user) override -- cgit v1.3.1-10-gc9f91