summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ssl_mbedtls.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-08 14:31:49 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-08-08 14:31:49 +0200
commiteef55acb1dbb2ae6c0202fec54e12506c064f892 (patch)
treed7e4e3e313053294192715d9f7bca1b426b8d232 /src/modules/extra/m_ssl_mbedtls.cpp
parent3a11a742ba35155e1b2e14dc4ef1a4f7f659ea13 (diff)
Add StreamSocket::GetModHook() for obtaining the IOHook belonging to a given module
Use it to simplify logic in all modules using or providing IOHooks
Diffstat (limited to 'src/modules/extra/m_ssl_mbedtls.cpp')
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index 7efcce72d..845d02aa3 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -894,7 +894,7 @@ class ModuleSSLmbedTLS : public Module
return;
LocalUser* user = IS_LOCAL(static_cast<User*>(item));
- if ((user) && (user->eh.GetIOHook()) && (user->eh.GetIOHook()->prov->creator == this))
+ if ((user) && (user->eh.GetModHook(this)))
{
// User is using SSL, they're a local user, and they're using our IOHook.
// Potentially there could be multiple SSL modules loaded at once on different ports.
@@ -904,13 +904,9 @@ class ModuleSSLmbedTLS : public Module
ModResult OnCheckReady(LocalUser* user) CXX11_OVERRIDE
{
- if ((user->eh.GetIOHook()) && (user->eh.GetIOHook()->prov->creator == this))
- {
- mbedTLSIOHook* iohook = static_cast<mbedTLSIOHook*>(user->eh.GetIOHook());
- if (!iohook->IsHandshakeDone())
- return MOD_RES_DENY;
- }
-
+ const mbedTLSIOHook* const iohook = static_cast<mbedTLSIOHook*>(user->eh.GetModHook(this));
+ if ((iohook) && (!iohook->IsHandshakeDone()))
+ return MOD_RES_DENY;
return MOD_RES_PASSTHRU;
}