mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-23 19:21:23 +02:00
Fix the active conn type logic
This commit is contained in:
parent
7581bbd925
commit
69d8d5aa86
@ -91,6 +91,7 @@ type Conn struct {
|
|||||||
|
|
||||||
statusRelay ConnStatus
|
statusRelay ConnStatus
|
||||||
statusICE ConnStatus
|
statusICE ConnStatus
|
||||||
|
currentConnType ConnPriority
|
||||||
|
|
||||||
workerICE *WorkerICE
|
workerICE *WorkerICE
|
||||||
workerRelay *WorkerRelay
|
workerRelay *WorkerRelay
|
||||||
@ -99,8 +100,6 @@ type Conn struct {
|
|||||||
beforeAddPeerHooks []BeforeAddPeerHookFunc
|
beforeAddPeerHooks []BeforeAddPeerHookFunc
|
||||||
afterRemovePeerHooks []AfterRemovePeerHookFunc
|
afterRemovePeerHooks []AfterRemovePeerHookFunc
|
||||||
|
|
||||||
currentConnType ConnPriority
|
|
||||||
|
|
||||||
endpointRelay *net.UDPAddr
|
endpointRelay *net.UDPAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,9 +365,13 @@ func (conn *Conn) relayConnectionIsReady(rci RelayConnInfo) {
|
|||||||
|
|
||||||
conn.statusRelay = stateConnected
|
conn.statusRelay = stateConnected
|
||||||
|
|
||||||
|
// todo review this condition
|
||||||
if conn.currentConnType > connPriorityRelay {
|
if conn.currentConnType > connPriorityRelay {
|
||||||
|
if conn.statusICE == StatusConnected {
|
||||||
|
log.Debugf("do not switch to relay because current priority is: %v", conn.currentConnType)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if conn.currentConnType != 0 {
|
if conn.currentConnType != 0 {
|
||||||
conn.log.Infof("update connection to Relay type")
|
conn.log.Infof("update connection to Relay type")
|
||||||
@ -430,6 +433,7 @@ func (conn *Conn) iCEConnectionIsReady(priority ConnPriority, iceConnInfo ICECon
|
|||||||
|
|
||||||
conn.statusICE = stateConnected
|
conn.statusICE = stateConnected
|
||||||
|
|
||||||
|
// todo review this condition
|
||||||
if conn.currentConnType > priority {
|
if conn.currentConnType > priority {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user