fix tunnel connector selection
This commit is contained in:
parent
3616a0d8a4
commit
5ee7746aab
@ -121,7 +121,6 @@ func (t *Tunnel) GetConnector(network string) *Connector {
|
|||||||
rw.Reset()
|
rw.Reset()
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
var connectors []*Connector
|
|
||||||
for _, c := range t.connectors {
|
for _, c := range t.connectors {
|
||||||
if c.Session().IsClosed() {
|
if c.Session().IsClosed() {
|
||||||
continue
|
continue
|
||||||
@ -135,19 +134,15 @@ func (t *Tunnel) GetConnector(network string) *Connector {
|
|||||||
if network == "udp" && c.id.IsUDP() ||
|
if network == "udp" && c.id.IsUDP() ||
|
||||||
network != "udp" && !c.id.IsUDP() {
|
network != "udp" && !c.id.IsUDP() {
|
||||||
if weight == MaxWeight && !found {
|
if weight == MaxWeight && !found {
|
||||||
connectors = nil
|
rw.Reset()
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if weight == MaxWeight || !found {
|
if weight == MaxWeight || !found {
|
||||||
connectors = append(connectors, c)
|
|
||||||
rw.Add(c, int(weight))
|
rw.Add(c, int(weight))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(connectors) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return rw.Next()
|
return rw.Next()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user