mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
client: reset encoders between uses
According to go/codec's docs, Reset(...) should be called on Decoders/Encoders before reuse: https://godoc.org/github.com/ugorji/go/codec I could find no evidence that *not* calling Reset() caused bugs, but might as well do what the docs say?
This commit is contained in:
@@ -361,6 +361,7 @@ func (s *HTTPServer) fsStreamImpl(resp http.ResponseWriter,
|
||||
cancel()
|
||||
return
|
||||
}
|
||||
encoder.Reset(httpPipe)
|
||||
|
||||
for {
|
||||
select {
|
||||
@@ -377,6 +378,7 @@ func (s *HTTPServer) fsStreamImpl(resp http.ResponseWriter,
|
||||
cancel()
|
||||
return
|
||||
}
|
||||
decoder.Reset(httpPipe)
|
||||
|
||||
if err := res.Error; err != nil {
|
||||
if err.Code != nil {
|
||||
|
||||
Reference in New Issue
Block a user