should return all tokens

This commit is contained in:
xtaci
2019-11-26 22:59:58 +08:00
parent c913b2d39b
commit 795b9695f3
+1 -1
View File
@@ -104,8 +104,8 @@ func (s *Stream) WriteTo(w io.Writer) (n int64, err error) {
if buf != nil {
nw, ew := w.Write(buf)
defaultAllocator.Put(buf)
s.sess.returnTokens(len(buf))
if nw > 0 {
s.sess.returnTokens(nw)
n += int64(nw)
}