aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorbloonfield <bloonfield@163.com>2017-06-26 17:26:22 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-06-26 17:26:22 +0800
commit413dc1d2651541dddb242716416a0427b0a656da (patch)
treec7c72eec2dda2e3688cdd5596bff8e0440324abc /rpc
parentfdf2184b1ecc48c6f2e106dd8cff85ec1765e998 (diff)
downloaddexon-413dc1d2651541dddb242716416a0427b0a656da.tar.gz
dexon-413dc1d2651541dddb242716416a0427b0a656da.tar.zst
dexon-413dc1d2651541dddb242716416a0427b0a656da.zip
rpc: fix closure problem in batch processing (#14688)
Demo of the issue: https://play.golang.org/p/EeTLFfppqC
Diffstat (limited to 'rpc')
-rw-r--r--rpc/http.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/rpc/http.go b/rpc/http.go
index 6bab02ab6..4143e2a8d 100644
--- a/rpc/http.go
+++ b/rpc/http.go
@@ -103,8 +103,8 @@ func (c *Client) sendBatchHTTP(ctx context.Context, op *requestOp, msgs []*jsonr
if err := json.NewDecoder(respBody).Decode(&respmsgs); err != nil {
return err
}
- for _, respmsg := range respmsgs {
- op.resp <- &respmsg
+ for i := 0; i < len(respmsgs); i++ {
+ op.resp <- &respmsgs[i]
}
return nil
}