service: handle input priority better
Ensure, that inputs with higher priorities are preferred. The decision line is: 1) re-use input if the in-use mux matches 2) use a free input with highest priority 3) cancel the mux/input with smallest weight and use it for new
This commit is contained in:
parent
2be0f84f0f
commit
521c49e14b
1 changed files with 10 additions and 3 deletions
|
@ -567,14 +567,21 @@ service_find_instance
|
|||
return si;
|
||||
}
|
||||
|
||||
/* Forced or Idle */
|
||||
/* Forced */
|
||||
TAILQ_FOREACH(si, sil, si_link)
|
||||
if(si->si_weight <= 0 && si->si_error == 0)
|
||||
if(si->si_weight < 0 && si->si_error == 0)
|
||||
break;
|
||||
|
||||
/* Idle */
|
||||
if (!si) {
|
||||
TAILQ_FOREACH_REVERSE(si, sil, service_instance_list, si_link)
|
||||
if (si->si_weight == 0 && si->si_error == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Bump someone */
|
||||
if (!si) {
|
||||
TAILQ_FOREACH_REVERSE(si, sil, service_instance_list, si_link)
|
||||
TAILQ_FOREACH(si, sil, si_link)
|
||||
if (weight > si->si_weight && si->si_error == 0)
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue