Skip to content

Commit defa295

Browse files
committed
skip group outbounds without a selected outbound
1 parent becb604 commit defa295

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

protocol/group/mutableurltest.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,8 @@ func (g *urlTestGroup) updateSelected() {
508508

509509
func (g *urlTestGroup) pickBestOutbound(network string, current A.Outbound) A.Outbound {
510510
var (
511-
minDelay uint16
512-
minOutbound A.Outbound
513-
haveOutbounds bool
511+
minDelay uint16
512+
minOutbound A.Outbound
514513
)
515514
if current != nil {
516515
if history := g.history.LoadURLTestHistory(realTag(current)); history != nil {
@@ -522,10 +521,6 @@ func (g *urlTestGroup) pickBestOutbound(network string, current A.Outbound) A.Ou
522521
if !slices.Contains(outbound.Network(), network) {
523522
continue
524523
}
525-
haveOutbounds = true
526-
if minOutbound == nil {
527-
minOutbound = outbound
528-
}
529524
rTag := realTag(outbound)
530525
if rTag == "" {
531526
continue
@@ -539,10 +534,15 @@ func (g *urlTestGroup) pickBestOutbound(network string, current A.Outbound) A.Ou
539534
minOutbound = outbound
540535
}
541536
}
542-
if !haveOutbounds {
543-
return nil
537+
if minOutbound != nil {
538+
return minOutbound
544539
}
545-
return minOutbound
540+
for _, outbound := range g.outbounds.Iter() {
541+
if slices.Contains(outbound.Network(), network) && realTag(outbound) != "" {
542+
return outbound
543+
}
544+
}
545+
return nil
546546
}
547547

548548
func realTag(outbound A.Outbound) string {

0 commit comments

Comments
 (0)