service: find the tuner/source with the lowest weight for the override action
This commit is contained in:
parent
8d9608b611
commit
92ca7963f2
1 changed files with 9 additions and 3 deletions
|
@ -528,6 +528,7 @@ service_find_instance
|
|||
{
|
||||
channel_service_mapping_t *csm;
|
||||
service_instance_t *si, *next;
|
||||
int weight2;
|
||||
|
||||
lock_assert(&global_lock);
|
||||
|
||||
|
@ -579,11 +580,16 @@ service_find_instance
|
|||
break;
|
||||
}
|
||||
|
||||
/* Bump someone */
|
||||
/* Bump the one with lowest weight */
|
||||
if (!si) {
|
||||
next = NULL;
|
||||
weight2 = weight;
|
||||
TAILQ_FOREACH(si, sil, si_link)
|
||||
if (weight > si->si_weight && si->si_error == 0)
|
||||
break;
|
||||
if (weight2 > si->si_weight && si->si_error == 0) {
|
||||
weight2 = si->si_weight;
|
||||
next = si;
|
||||
}
|
||||
si = next;
|
||||
}
|
||||
|
||||
/* Failed */
|
||||
|
|
Loading…
Add table
Reference in a new issue