MXS-1539: Add asynchronous authenticator capability

The new ACAP_TYPE_ASYNC capability allows the authenticator to tell the
core that all entry points for it support asynchronous usage.
This commit is contained in:
Markus Mäkelä
2018-01-02 13:46:42 +02:00
parent 6036c1cdca
commit 8d15256d70
2 changed files with 11 additions and 1 deletions

View File

@ -1621,6 +1621,11 @@ int service_refresh_users(SERVICE *service)
ss_dassert(self >= 0);
time_t now = time(NULL);
if ((service->capabilities & ACAP_TYPE_ASYNC) == 0)
{
spinlock_acquire(&service->spin);
}
/* Check if refresh rate limit has been exceeded */
if ((now < service->rate_limits[self].last + USERS_REFRESH_TIME) ||
(service->rate_limits[self].nloads >= USERS_REFRESH_MAX_PER_TIME))
@ -1669,6 +1674,11 @@ int service_refresh_users(SERVICE *service)
}
}
if ((service->capabilities & ACAP_TYPE_ASYNC) == 0)
{
spinlock_release(&service->spin);
}
return ret;
}

View File

@ -98,7 +98,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
MXS_AUTHENTICATOR_VERSION,
"The MySQL client to MaxScale authenticator implementation",
"V1.1.0",
MXS_NO_MODULE_CAPABILITIES,
ACAP_TYPE_ASYNC,
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */