mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-21 12:22:06 +03:00
Initial allowlist support
This commit is contained in:
@ -27,9 +27,11 @@
|
||||
#include "wsrep/logger.hpp"
|
||||
#include "wsrep/thread_service.hpp"
|
||||
#include "wsrep/tls_service.hpp"
|
||||
#include "wsrep/allowlist_service.hpp"
|
||||
|
||||
#include "thread_service_v1.hpp"
|
||||
#include "tls_service_v1.hpp"
|
||||
#include "allowlist_service_v1.hpp"
|
||||
#include "v26/wsrep_api.h"
|
||||
|
||||
|
||||
@ -635,6 +637,23 @@ namespace
|
||||
// assert(not wsrep::tls_service_v1_probe(dlh));
|
||||
wsrep::tls_service_v1_deinit(dlh);
|
||||
}
|
||||
|
||||
static int init_allowlist_service(void* dlh,
|
||||
wsrep::allowlist_service* allowlist_service)
|
||||
{
|
||||
assert(allowlist_service);
|
||||
if (not wsrep::allowlist_service_v1_probe(dlh))
|
||||
{
|
||||
return wsrep::allowlist_service_v1_init(dlh, allowlist_service);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void deinit_allowlist_service(void* dlh)
|
||||
{
|
||||
// assert(not wsrep::allowlist_service_v1_probe(dlh));
|
||||
wsrep::allowlist_service_v1_deinit(dlh);
|
||||
}
|
||||
}
|
||||
|
||||
void wsrep::wsrep_provider_v26::init_services(
|
||||
@ -656,6 +675,14 @@ void wsrep::wsrep_provider_v26::init_services(
|
||||
}
|
||||
services_enabled_.tls_service = services.tls_service;
|
||||
}
|
||||
if (services.allowlist_service)
|
||||
{
|
||||
if (init_allowlist_service(wsrep_->dlh, services.allowlist_service))
|
||||
{
|
||||
throw wsrep::runtime_error("Failed to initialze allowlist service");
|
||||
}
|
||||
services_enabled_.allowlist_service = services.allowlist_service;
|
||||
}
|
||||
}
|
||||
|
||||
void wsrep::wsrep_provider_v26::deinit_services()
|
||||
@ -664,6 +691,8 @@ void wsrep::wsrep_provider_v26::deinit_services()
|
||||
deinit_tls_service(wsrep_->dlh);
|
||||
if (services_enabled_.thread_service)
|
||||
deinit_thread_service(wsrep_->dlh);
|
||||
if (services_enabled_.allowlist_service)
|
||||
deinit_allowlist_service(wsrep_->dlh);
|
||||
}
|
||||
|
||||
wsrep::wsrep_provider_v26::wsrep_provider_v26(
|
||||
|
Reference in New Issue
Block a user