mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-14 02:41:34 +01:00
Change logging logic
This commit is contained in:
parent
81f2330d49
commit
f7e6aa9b8f
@ -94,7 +94,6 @@ func (h *Handshaker) Handshake(args HandshakeArgs) (*OfferAnswer, error) {
|
||||
return cachedOfferAnswer, nil
|
||||
}
|
||||
|
||||
h.log.Debugf("send offer")
|
||||
err := h.sendOffer(args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -120,6 +120,8 @@ func (w *WorkerICE) SetupICEConnection(hasRelayOnLocally bool) {
|
||||
|
||||
w.conn.OnStatusChanged(StatusConnecting)
|
||||
|
||||
w.log.Debugf("trying to establish ICE connection with peer %s", w.config.Key)
|
||||
|
||||
remoteOfferAnswer, err := w.conn.DoHandshake()
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrSignalIsNotReady) {
|
||||
|
@ -49,6 +49,8 @@ func (w *WorkerRelay) SetupRelayConnection() {
|
||||
return
|
||||
}
|
||||
|
||||
w.log.Debugf("trying to establish Relay connection with peer %s", w.config.Key)
|
||||
|
||||
remoteOfferAnswer, err := w.conn.DoHandshake()
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrSignalIsNotReady) {
|
||||
@ -59,6 +61,7 @@ func (w *WorkerRelay) SetupRelayConnection() {
|
||||
}
|
||||
|
||||
if !w.isRelaySupported(remoteOfferAnswer) {
|
||||
w.log.Infof("Relay is not supported by remote peer")
|
||||
// todo should we retry?
|
||||
// if the remote peer doesn't support relay make no sense to retry infinity
|
||||
// but if the remote peer supports relay just the connection is lost we should retry
|
||||
@ -68,12 +71,14 @@ func (w *WorkerRelay) SetupRelayConnection() {
|
||||
// the relayManager will return with error in case if the connection has lost with relay server
|
||||
currentRelayAddress, err := w.relayManager.RelayAddress()
|
||||
if err != nil {
|
||||
w.log.Infof("local Relay connection is lost, skipping connection attempt")
|
||||
continue
|
||||
}
|
||||
|
||||
srv := w.preferredRelayServer(currentRelayAddress.String(), remoteOfferAnswer.RelaySrvAddress)
|
||||
relayedConn, err := w.relayManager.OpenConn(srv, w.config.Key)
|
||||
if err != nil {
|
||||
w.log.Infof("failed to open relay connection: %s", err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user