Log ICE reconnected. (#2999)
To increase visibility of ICE reconnect, logging reconnected at Infow level. Otherwise, it is hard to see if an ICE restart finished successfully. Also, cleaning up ICEConnectionDetails a bit. Just separate out read-only fields into its own struct and use it for read-only export.
This commit is contained in:
+14
-14
@@ -455,10 +455,10 @@ func (r *Room) Join(participant types.LocalParticipant, requestSource routing.Me
|
||||
meta := &livekit.AnalyticsClientMeta{
|
||||
ClientConnectTime: uint32(time.Since(p.ConnectedAt()).Milliseconds()),
|
||||
}
|
||||
cds := p.GetICEConnectionDetails()
|
||||
for _, cd := range cds {
|
||||
if cd.Type != types.ICEConnectionTypeUnknown {
|
||||
meta.ConnectionType = string(cd.Type)
|
||||
infos := p.GetICEConnectionInfo()
|
||||
for _, info := range infos {
|
||||
if info.Type != types.ICEConnectionTypeUnknown {
|
||||
meta.ConnectionType = string(info.Type)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -469,7 +469,7 @@ func (r *Room) Join(participant types.LocalParticipant, requestSource routing.Me
|
||||
false,
|
||||
)
|
||||
|
||||
p.GetLogger().Infow("participant active", connectionDetailsFields(cds)...)
|
||||
p.GetLogger().Infow("participant active", connectionDetailsFields(infos)...)
|
||||
} else if state == livekit.ParticipantInfo_DISCONNECTED {
|
||||
// remove participant from room
|
||||
// participant should already be closed and have a close reason, so NONE is fine here
|
||||
@@ -695,7 +695,7 @@ func (r *Room) RemoveParticipant(identity livekit.ParticipantIdentity, pID livek
|
||||
r.protoProxy.MarkDirty(immediateChange)
|
||||
|
||||
if !p.HasConnected() {
|
||||
fields := append(connectionDetailsFields(p.GetICEConnectionDetails()),
|
||||
fields := append(connectionDetailsFields(p.GetICEConnectionInfo()),
|
||||
"reason", reason.String(),
|
||||
)
|
||||
p.GetLogger().Infow("removing participant without connection", fields...)
|
||||
@@ -1804,12 +1804,12 @@ func IsCloseNotifySkippable(closeReason types.ParticipantCloseReason) bool {
|
||||
return closeReason == types.ParticipantCloseReasonDuplicateIdentity
|
||||
}
|
||||
|
||||
func connectionDetailsFields(cds []*types.ICEConnectionDetails) []interface{} {
|
||||
func connectionDetailsFields(infos []*types.ICEConnectionInfo) []interface{} {
|
||||
var fields []interface{}
|
||||
connectionType := types.ICEConnectionTypeUnknown
|
||||
for _, cd := range cds {
|
||||
candidates := make([]string, 0, len(cd.Remote)+len(cd.Local))
|
||||
for _, c := range cd.Local {
|
||||
for _, info := range infos {
|
||||
candidates := make([]string, 0, len(info.Remote)+len(info.Local))
|
||||
for _, c := range info.Local {
|
||||
cStr := "[local]"
|
||||
if c.Selected {
|
||||
cStr += "[selected]"
|
||||
@@ -1822,7 +1822,7 @@ func connectionDetailsFields(cds []*types.ICEConnectionDetails) []interface{} {
|
||||
cStr += " " + c.Local.String()
|
||||
candidates = append(candidates, cStr)
|
||||
}
|
||||
for _, c := range cd.Remote {
|
||||
for _, c := range info.Remote {
|
||||
cStr := "[remote]"
|
||||
if c.Selected {
|
||||
cStr += "[selected]"
|
||||
@@ -1836,10 +1836,10 @@ func connectionDetailsFields(cds []*types.ICEConnectionDetails) []interface{} {
|
||||
candidates = append(candidates, cStr)
|
||||
}
|
||||
if len(candidates) > 0 {
|
||||
fields = append(fields, fmt.Sprintf("%sCandidates", strings.ToLower(cd.Transport.String())), candidates)
|
||||
fields = append(fields, fmt.Sprintf("%sCandidates", strings.ToLower(info.Transport.String())), candidates)
|
||||
}
|
||||
if cd.Type != types.ICEConnectionTypeUnknown {
|
||||
connectionType = cd.Type
|
||||
if info.Type != types.ICEConnectionTypeUnknown {
|
||||
connectionType = info.Type
|
||||
}
|
||||
}
|
||||
fields = append(fields, "connectionType", connectionType)
|
||||
|
||||
Reference in New Issue
Block a user