Skip to content

Commit

Permalink
Add verbose log
Browse files Browse the repository at this point in the history
  • Loading branch information
pappz committed Oct 29, 2024
1 parent 530a410 commit ddd0425
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions client/internal/peer/worker_ice.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (w *WorkerICE) OnNewOffer(remoteOfferAnswer *OfferAnswer) {
w.log.Debugf("failed to dial the remote peer: %s", err)
return
}
if remoteConnNil(remoteConn) {
if w.remoteConnNil(remoteConn) {
w.log.Errorf("unexpected remote conn state")
return
}
Expand Down Expand Up @@ -331,6 +331,19 @@ func (w *WorkerICE) turnAgentDial(ctx context.Context, remoteOfferAnswer *OfferA
return w.agent.Accept(ctx, remoteOfferAnswer.IceCredentials.UFrag, remoteOfferAnswer.IceCredentials.Pwd)
}
}
func (w *WorkerICE) remoteConnNil(conn *ice.Conn) bool {
if conn == nil {
w.log.Errorf("ice conn is nil")
return true
}

if conn.RemoteAddr() == nil {
w.log.Errorf("ICE remote address is nil")
return true
}

return false
}

func extraSrflxCandidate(candidate ice.Candidate) (*ice.CandidateServerReflexive, error) {
relatedAdd := candidate.RelatedAddress()
Expand Down Expand Up @@ -382,7 +395,3 @@ func isRelayed(pair *ice.CandidatePair) bool {
}
return false
}

func remoteConnNil(conn *ice.Conn) bool {
return conn == nil || conn.RemoteAddr() == nil
}

0 comments on commit ddd0425

Please sign in to comment.