Take Backend into use in rwsplit_select_backends.cc

This is the first step to taking the Backend class into use. It is now
used in rwsplit_select_backends.cc and readwritesplit.hh. The module is
not yet functional and doesn't even compile.

Added some helper functions to the Backend class to get easier access to
the server referenced by the SERVER_REF and to check the state of the
backend.
This commit is contained in:
Markus Mäkelä
2017-06-15 13:16:52 +03:00
parent 05fef4b23e
commit 5a5effdf7a
5 changed files with 126 additions and 228 deletions

View File

@ -936,6 +936,23 @@ SRWBackend get_backend_from_bref(ROUTER_CLIENT_SES* rses, backend_ref_t* bref)
return SRWBackend();
}
void close_all_connections(ROUTER_CLIENT_SES* rses)
{
for (SRWBackendList::iterator it = rses->backends.begin();
it != rses->backends.end(); it++)
{
if (BREF_IS_IN_USE((&backend_ref[i])))
{
SRWBackend& bref = *it;
if (bref->in_use())
{
bref->close();
}
}
}
}
/**
* API function definitions
*/