From 3611fcf783dd30f1f1b9369bb35aa884a68008ed Mon Sep 17 00:00:00 2001 From: jaer-tsun <13284103+jaer-tsun@users.noreply.github.com> Date: Thu, 28 Feb 2019 17:10:22 -0800 Subject: [PATCH] Reset tb connections (#308) * Limiting the size of our buffered payload to ~2MB * Clearing/resetting connections slice in telemetry buffer. --- telemetry/telemetrybuffer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telemetry/telemetrybuffer.go b/telemetry/telemetrybuffer.go index 54e9e70df..cb5436a98 100644 --- a/telemetry/telemetrybuffer.go +++ b/telemetry/telemetrybuffer.go @@ -239,13 +239,15 @@ func (tb *TelemetryBuffer) Close() { tb.listener = nil } - for index, conn := range tb.connections { + for _, conn := range tb.connections { if conn != nil { telemetryLogger.Printf("connection close") conn.Close() - remove(tb.connections, index) } } + + tb.connections = nil + tb.connections = make([]net.Conn, 0) } // sendToHost - send payload to host