Commit 4d89adc
committed
fix(body): set an internal max to reserve in
Previously, `to_bytes` would reserve extra space if after two chunks,
there was more remaining. It used to reserve however much space the peer
advertized.
This changes now only reserves up to ~16kb. This way, a slow message
with a big body doesn't reserve so much memory, until the data has
actually been received.
The existing warning to check for a length before calling the function
is still the best approach.to_bytes
1 parent 031425f commit 4d89adc
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
66 | 72 | | |
67 | | - | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
0 commit comments