mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
Enforce HW_BUFFER_SIZE inside h1::dispatcher (#1550)
This commit is contained in:
parent
4f9a1ac3b7
commit
e72ee28232
@ -1,5 +1,11 @@
|
||||
# Changes
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
* Fix actix_http::h1::dispatcher so it returns when HW_BUFFER_SIZE is reached. Should reduce peak memory consumption during large uploads. [#1550]
|
||||
|
||||
## [3.0.0-alpha.3] - 2020-05-21
|
||||
|
||||
### Added
|
||||
|
@ -861,7 +861,14 @@ where
|
||||
T: AsyncRead + Unpin,
|
||||
{
|
||||
let mut read_some = false;
|
||||
|
||||
loop {
|
||||
// If buf is full return but do not disconnect since
|
||||
// there is more reading to be done
|
||||
if buf.len() >= HW_BUFFER_SIZE {
|
||||
return Ok(Some(false));
|
||||
}
|
||||
|
||||
let remaining = buf.capacity() - buf.len();
|
||||
if remaining < LW_BUFFER_SIZE {
|
||||
buf.reserve(HW_BUFFER_SIZE - remaining);
|
||||
|
Loading…
Reference in New Issue
Block a user