Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2019-03-15 12:31:08 +02:00
11 changed files with 94 additions and 61 deletions

View File

@ -221,7 +221,7 @@ PRWBackends::iterator find_best_backend(PRWBackends& backends,
bool masters_accepts_reads)
{
// Group backends by priority. The set of highest priority backends will then compete.
int best_priority {INT_MAX}; // low numbers are high priority
int best_priority {2}; // low numbers are high priority
for (auto& psBackend : backends)
{
@ -251,7 +251,12 @@ PRWBackends::iterator find_best_backend(PRWBackends& backends,
}
auto best = select(priority_map[best_priority]);
auto rval = std::find(backends.begin(), backends.end(), *best);
auto rval = backends.end();
if (best != priority_map[best_priority].end())
{
rval = std::find(backends.begin(), backends.end(), *best);
}
for (auto& a : priority_map)
{