Log ICE reconnected when selected pair changes. (#3117)
Logging selected pair when ICE connection state changed could have picked up previous selected pair. Also, log shortened remote IP and remote port.
This commit is contained in:
@@ -150,6 +150,8 @@ func (w wrappedICECandidatePairLogger) MarshalLogObject(e zapcore.ObjectEncoder)
|
|||||||
if w.pair.Remote != nil {
|
if w.pair.Remote != nil {
|
||||||
e.AddString("remoteProtocol", w.pair.Remote.Protocol.String())
|
e.AddString("remoteProtocol", w.pair.Remote.Protocol.String())
|
||||||
e.AddString("remoteCandidateType", w.pair.Remote.Typ.String())
|
e.AddString("remoteCandidateType", w.pair.Remote.Typ.String())
|
||||||
|
e.AddString("remoteAdddress", w.pair.Remote.Address[:len(w.pair.Remote.Address)-3]+"...")
|
||||||
|
e.AddUint16("remotePort", w.pair.Remote.Port)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -468,6 +470,9 @@ func (t *PCTransport) createPeerConnection() error {
|
|||||||
t.pc.SCTP().Transport().ICETransport().OnSelectedCandidatePairChange(func(pair *webrtc.ICECandidatePair) {
|
t.pc.SCTP().Transport().ICETransport().OnSelectedCandidatePairChange(func(pair *webrtc.ICECandidatePair) {
|
||||||
t.params.Logger.Debugw("selected ICE candidate pair changed", "pair", wrappedICECandidatePairLogger{pair})
|
t.params.Logger.Debugw("selected ICE candidate pair changed", "pair", wrappedICECandidatePairLogger{pair})
|
||||||
t.connectionDetails.SetSelectedPair(pair)
|
t.connectionDetails.SetSelectedPair(pair)
|
||||||
|
if t.selectedPair.Load() != nil {
|
||||||
|
t.params.Logger.Infow("ice reconnected or switched pair", "pair", wrappedICECandidatePairLogger{pair})
|
||||||
|
}
|
||||||
t.selectedPair.Store(pair)
|
t.selectedPair.Store(pair)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -648,8 +653,6 @@ func (t *PCTransport) onPeerConnectionStateChange(state webrtc.PeerConnectionSta
|
|||||||
t.params.Handler.OnInitialConnected()
|
t.params.Handler.OnInitialConnected()
|
||||||
|
|
||||||
t.maybeNotifyFullyEstablished()
|
t.maybeNotifyFullyEstablished()
|
||||||
} else {
|
|
||||||
t.params.Logger.Infow("ice reconnected", "pair", wrappedICECandidatePairLogger{t.selectedPair.Load()})
|
|
||||||
}
|
}
|
||||||
case webrtc.PeerConnectionStateFailed:
|
case webrtc.PeerConnectionStateFailed:
|
||||||
t.clearConnTimer()
|
t.clearConnTimer()
|
||||||
|
|||||||
Reference in New Issue
Block a user