mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
reset counters when closed.
This commit is contained in:
parent
d5c934f2af
commit
8ada0217d0
@ -184,6 +184,19 @@ func (m *metricsCtx) getBySession(session types.Session) metrics {
|
|||||||
return met
|
return met
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *metricsCtx) reset(met metrics) {
|
||||||
|
met.videoIdsMu.Lock()
|
||||||
|
for _, entry := range met.videoIds {
|
||||||
|
entry.Set(0)
|
||||||
|
}
|
||||||
|
met.videoIdsMu.Unlock()
|
||||||
|
|
||||||
|
met.receiverEstimatedMaximumBitrate.Set(0)
|
||||||
|
|
||||||
|
met.receiverReportDelay.Set(0)
|
||||||
|
met.receiverReportJitter.Set(0)
|
||||||
|
}
|
||||||
|
|
||||||
func (m *metricsCtx) NewConnection(session types.Session) {
|
func (m *metricsCtx) NewConnection(session types.Session) {
|
||||||
met := m.getBySession(session)
|
met := m.getBySession(session)
|
||||||
met.connectionCount.Add(1)
|
met.connectionCount.Add(1)
|
||||||
@ -219,6 +232,7 @@ func (m *metricsCtx) SetState(session types.Session, state webrtc.PeerConnection
|
|||||||
met.connectionState.Set(2)
|
met.connectionState.Set(2)
|
||||||
case webrtc.PeerConnectionStateClosed:
|
case webrtc.PeerConnectionStateClosed:
|
||||||
met.connectionState.Set(1)
|
met.connectionState.Set(1)
|
||||||
|
m.reset(met)
|
||||||
default:
|
default:
|
||||||
met.connectionState.Set(-1)
|
met.connectionState.Set(-1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user