From 3acc20231c9d822395add10939905b99984006f5 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 19 Feb 2016 13:40:02 +0000 Subject: [PATCH] Place buffer infront of the decoder and not the connection --- probe/docker/container.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/probe/docker/container.go b/probe/docker/container.go index fa3fac9a2c..9a948f2897 100644 --- a/probe/docker/container.go +++ b/probe/docker/container.go @@ -182,8 +182,7 @@ func (c *container) StartGatheringStats() error { return } - bufReader := bufio.NewReaderSize(dial, 8192) - conn := NewClientConnStub(dial, bufReader) + conn := NewClientConnStub(dial, nil) resp, err := conn.Do(req) if err != nil { log.Errorf("docker container: %v", err) @@ -204,7 +203,8 @@ func (c *container) StartGatheringStats() error { }() var stats docker.Stats - decoder := codec.NewDecoder(resp.Body, &codec.JsonHandle{}) + bufReader := bufio.NewReader(resp.Body) + decoder := codec.NewDecoder(bufReader, &codec.JsonHandle{}) for err := decoder.Decode(&stats); err != io.EOF; err = decoder.Decode(&stats) { if err != nil { log.Errorf("docker container: error reading event, did container stop? %v", err)