mirror of
https://github.com/netbirdio/netbird.git
synced 2025-03-03 09:21:12 +01:00
Fix slow peer open function
This commit is contained in:
parent
4b37311e54
commit
100e31276f
@ -188,18 +188,23 @@ func (conn *Conn) Open() {
|
|||||||
conn.log.Warnf("error while updating the state err: %v", err)
|
conn.log.Warnf("error while updating the state err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go conn.startHandshakeAndReconnect()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (conn *Conn) startHandshakeAndReconnect() {
|
||||||
conn.waitInitialRandomSleepTime()
|
conn.waitInitialRandomSleepTime()
|
||||||
|
|
||||||
err = conn.handshaker.sendOffer()
|
err := conn.handshaker.sendOffer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.log.Errorf("failed to send offer: %v", err)
|
conn.log.Errorf("failed to send initial offer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if conn.workerRelay.IsController() {
|
if conn.workerRelay.IsController() {
|
||||||
go conn.reconnectLoopWithRetry()
|
conn.reconnectLoopWithRetry()
|
||||||
} else {
|
} else {
|
||||||
go conn.reconnectLoopForOnDisconnectedEvent()
|
conn.reconnectLoopForOnDisconnectedEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close closes this peer Conn issuing a close event to the Conn closeCh
|
// Close closes this peer Conn issuing a close event to the Conn closeCh
|
||||||
|
@ -705,7 +705,6 @@ func (d *Status) GetFullStatus() FullStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fullStatus.Peers = append(fullStatus.Peers, d.offlinePeers...)
|
fullStatus.Peers = append(fullStatus.Peers, d.offlinePeers...)
|
||||||
|
|
||||||
return fullStatus
|
return fullStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user