mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
wgengine/magicsock: don't use endpoint debug ringbuffer on mobile.
Save some memory. Updates tailscale/corp#18514 Change-Id: Ibcaf3c6d8e5cc275c81f04141d0f176e2249509b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
512fc0b502
commit
5d1c72f76b
@@ -24,7 +24,12 @@ type RingBuffer[T any] struct {
|
||||
|
||||
// Add appends a new item to the RingBuffer, possibly overwriting the oldest
|
||||
// item in the buffer if it is already full.
|
||||
//
|
||||
// It does nothing if rb is nil.
|
||||
func (rb *RingBuffer[T]) Add(t T) {
|
||||
if rb == nil {
|
||||
return
|
||||
}
|
||||
rb.mu.Lock()
|
||||
defer rb.mu.Unlock()
|
||||
if len(rb.buf) < rb.max {
|
||||
@@ -37,6 +42,8 @@ func (rb *RingBuffer[T]) Add(t T) {
|
||||
|
||||
// GetAll returns a copy of all the entries in the ring buffer in the order they
|
||||
// were added.
|
||||
//
|
||||
// It returns nil if rb is nil.
|
||||
func (rb *RingBuffer[T]) GetAll() []T {
|
||||
if rb == nil {
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user