Fix slow peer open function

This commit is contained in:
Zoltán Papp 2024-07-29 15:56:19 +02:00
parent 4b37311e54
commit 100e31276f
2 changed files with 9 additions and 5 deletions

View File

@ -188,18 +188,23 @@ func (conn *Conn) Open() {
conn.log.Warnf("error while updating the state err: %v", err)
}
go conn.startHandshakeAndReconnect()
}
func (conn *Conn) startHandshakeAndReconnect() {
conn.waitInitialRandomSleepTime()
err = conn.handshaker.sendOffer()
err := conn.handshaker.sendOffer()
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() {
go conn.reconnectLoopWithRetry()
conn.reconnectLoopWithRetry()
} else {
go conn.reconnectLoopForOnDisconnectedEvent()
conn.reconnectLoopForOnDisconnectedEvent()
}
}
// Close closes this peer Conn issuing a close event to the Conn closeCh

View File

@ -705,7 +705,6 @@ func (d *Status) GetFullStatus() FullStatus {
}
fullStatus.Peers = append(fullStatus.Peers, d.offlinePeers...)
return fullStatus
}