Create RWBackends from servers

Added a helper function that creates a list of servers to use. This should
remove some of the duplicate code in the routers.
This commit is contained in:
Markus Mäkelä
2018-03-29 10:30:33 +03:00
parent 6ef9e1fd9a
commit d5643bc14d
3 changed files with 23 additions and 12 deletions

View File

@ -660,15 +660,7 @@ RWSplitSession* RWSplitSession::create(RWSplit* router, MXS_SESSION* session)
if (router->have_enough_servers())
{
SRWBackendList backends;
for (SERVER_REF *sref = router->service()->dbref; sref; sref = sref->next)
{
if (sref->active)
{
backends.push_back(SRWBackend(new RWBackend(sref)));
}
}
SRWBackendList backends = RWBackend::from_servers(router->service()->dbref);
/**
* At least the master must be found if the router is in the strict mode.