Option to disable traffic load tracking. (#2698)

This commit is contained in:
Raja Subramanian
2024-05-02 19:09:12 +05:30
committed by GitHub
parent 2792e7e834
commit 674550ea16
3 changed files with 20 additions and 6 deletions
+8
View File
@@ -62,6 +62,10 @@ func (p *ParticipantTrafficLoad) Close() {
}
func (p *ParticipantTrafficLoad) OnTrafficLoad(f func(trafficLoad *types.TrafficLoad)) {
if p == nil {
return
}
p.lock.Lock()
p.onTrafficLoad = f
p.lock.Unlock()
@@ -75,6 +79,10 @@ func (p *ParticipantTrafficLoad) getOnTrafficLoad() func(trafficLoad *types.Traf
}
func (p *ParticipantTrafficLoad) GetTrafficLoad() *types.TrafficLoad {
if p == nil {
return nil
}
p.lock.RLock()
defer p.lock.RUnlock()