Skip to content

Commit

Permalink
limit the number of batch requests to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Feb 14, 2023
1 parent 55f41d1 commit 7f3d7e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ func (h *handler) handleBatch(msgs []*jsonrpcMessage) {
return
}

if len(msgs) > 100 {
h.startCallProc(func(cp *callProc) {
resp := errorMessage(&invalidRequestError{"batch too large"})
h.conn.writeJSON(cp.ctx, resp, true)
})
return
}

// Handle non-call messages first:
calls := make([]*jsonrpcMessage, 0, len(msgs))
for _, msg := range msgs {
Expand Down

0 comments on commit 7f3d7e6

Please sign in to comment.