Change logging logic

This commit is contained in:
Zoltán Papp 2024-06-19 18:16:43 +02:00
parent 81f2330d49
commit f7e6aa9b8f
3 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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
}