Skip to content

Commit

Permalink
monitor: Rename send to sendToListeners
Browse files Browse the repository at this point in the history
This commit contains no functional changes and is intended to improve
the readability of code changes in subsequent commits.

Signed-off-by: Sebastian Wicki <[email protected]>
  • Loading branch information
gandro committed Jul 30, 2020
1 parent 9b44cdf commit 26f22c4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/monitor/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (a *Agent) SendEvent(typ int, event interface{}) error {
}

p := payload.Payload{Data: buf.Bytes(), CPU: 0, Lost: 0, Type: payload.EventSample}
a.send(&p)
a.sendToListeners(&p)

return nil
}
Expand Down Expand Up @@ -263,7 +263,7 @@ func (a *Agent) processPerfRecord(record perf.Record) {
Lost: record.LostSamples,
Type: plType,
}
a.sendLocked(&pl)
a.sendToListenersLocked(&pl)
a.Unlock()
}

Expand All @@ -285,15 +285,15 @@ func (a *Agent) State() *models.MonitorStatus {
return &status
}

// send enqueues the payload to all listeners.
func (a *Agent) send(pl *payload.Payload) {
// sendToListeners enqueues the payload to all listeners.
func (a *Agent) sendToListeners(pl *payload.Payload) {
a.Lock()
defer a.Unlock()
a.sendLocked(pl)
a.sendToListenersLocked(pl)
}

// sendLocked enqueues the payload to all listeners while holding the monitor lock.
func (a *Agent) sendLocked(pl *payload.Payload) {
// sendToListenersLocked enqueues the payload to all listeners while holding the monitor lock.
func (a *Agent) sendToListenersLocked(pl *payload.Payload) {
for ml := range a.listeners {
ml.Enqueue(pl)
}
Expand Down

0 comments on commit 26f22c4

Please sign in to comment.