(e *traceEvent)
| 105 | } |
| 106 | |
| 107 | func (c *ChannelTrace) append(e *traceEvent) { |
| 108 | c.mu.Lock() |
| 109 | if len(c.Events) == getMaxTraceEntry() { |
| 110 | del := c.Events[0] |
| 111 | c.Events = c.Events[1:] |
| 112 | if del.RefID != 0 { |
| 113 | // start recursive cleanup in a goroutine to not block the call originated from grpc. |
| 114 | go func() { |
| 115 | // need to acquire c.cm.mu lock to call the unlocked attemptCleanup func. |
| 116 | c.cm.mu.Lock() |
| 117 | c.cm.decrTraceRefCount(del.RefID) |
| 118 | c.cm.mu.Unlock() |
| 119 | }() |
| 120 | } |
| 121 | } |
| 122 | e.Timestamp = time.Now() |
| 123 | c.Events = append(c.Events, e) |
| 124 | c.EventNum++ |
| 125 | c.mu.Unlock() |
| 126 | } |
| 127 | |
| 128 | func (c *ChannelTrace) clear() { |
| 129 | if c.clearCalled { |
no test coverage detected