Move listener parameter handling into Listener::create

The Listener::create method now takes a set of configuration parameters
from which it constructs a listener. This removes the duplicated code and
makes the behavior of listener creation similar to other objects in
MaxScale. It also allows the configuration parameters to be stored in the
listener object itself.
This commit is contained in:
Markus Mäkelä
2019-05-08 09:39:19 +03:00
parent ca21d27c68
commit 3813c728b1
12 changed files with 214 additions and 207 deletions

View File

@ -188,8 +188,13 @@ static void blr_start_master(void* data)
pthread_mutex_unlock(&router->lock);
// Create a temporary listener so we can create a session originating from it
auto listener = Listener::create(router->service, "binlogrouter_listener", "mariadbclient",
"127.0.0.1", 9999, "", "", nullptr);
MXS_CONFIG_PARAMETER listener_params;
listener_params.set(CN_ADDRESS, "127.0.0.1");
listener_params.set(CN_PORT, "9999");
listener_params.set(CN_PROTOCOL, "mariadbclient");
listener_params.set(CN_SERVICE, router->service->name());
auto listener = Listener::create("binlogrouter_listener", "mariadbclient", listener_params);
mxb_assert(listener);
// Load users now so that authentication will work for the fake client
@ -1708,7 +1713,7 @@ bool blr_send_event(blr_thread_role_t role,
const char* binlog_name,
uint32_t binlog_pos,
ROUTER_SLAVE* slave,
REP_HEADER* hdr,
REP_HEADER* hdr,
uint8_t* buf)
{
bool rval = true;