diff --git a/rpc_client.go b/rpc_client.go index 3d1e7d2..b6bdbb5 100644 --- a/rpc_client.go +++ b/rpc_client.go @@ -95,7 +95,7 @@ func (cli *RPCClient) run() { defer stream.CloseSend() var ticker = time.NewTicker(time.Millisecond * 20) - var frames [][]byte + buf := bytes.NewBuffer(nil) for { @@ -105,8 +105,8 @@ func (cli *RPCClient) run() { } buf.Reset() cli.Lock(func() bool { - Compress(buf, frames) - frames = frames[:0] + Compress(buf, cli.Frames) + cli.Frames = cli.Frames[:0] return true })