Fix stream::read_size_hint calculation

This commit is contained in:
Vinnie Falco committed 2017-08-04 19:02:13 -07:00
1 parent 576edfaaed
commit 028fda0237
2 files changed
+6 -2

No files matched your search

@@ -98,8 +98,11 @@ read_size_hint(
buffer.max_size(), clamp(rd_.remain));
}
}
return (std::min)(buffer.max_size(), (std::max)(
(std::max)(+tcp_frame_size, clamp(rd_.remain)),
return (std::min)(
buffer.max_size() - buffer.size(),
(std::max)((std::max)(
+tcp_frame_size,
clamp(rd_.remain)),
buffer.capacity() - buffer.size()));
}