Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Unified Diff: net/spdy/spdy_framer.cc

Issue 2130153002: Clean up max_frame_size related constants, move storage of setting to the framer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a typo in net/spdy/spdy_protocol.h. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | net/spdy/spdy_protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer.cc
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 0901fe4c38b21b42b1f795ed5607e29f7a1593f6..ca8b7e082ac807bdda19e8ba1f74d9780160bfad 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -119,6 +119,7 @@ const size_t SpdyFramer::kHeaderDataChunkMaxSize = 1024;
// limit on control frame size for legacy reasons and to
// mitigate DOS attacks.
const size_t SpdyFramer::kMaxControlFrameSize = (1 << 14) - 1;
+const size_t SpdyFramer::kMaxDataPayloadSendSize = 1 << 14;
// The size of the control frame buffer. Must be >= the minimum size of the
// largest control frame, which is SYN_STREAM. See GetSynStreamMinimumSize() for
// calculation details.
@@ -421,11 +422,21 @@ size_t SpdyFramer::GetFrameMinimumSize() const {
}
size_t SpdyFramer::GetFrameMaximumSize() const {
- return SpdyConstants::GetFrameMaximumSize(protocol_version_);
+ if (protocol_version_ == HTTP2) {
+ return send_frame_size_limit_ +
+ SpdyConstants::GetFrameHeaderSize(protocol_version_);
+ } else {
+ return SpdyConstants::GetMaxFrameSizeLimit(protocol_version_);
+ }
}
size_t SpdyFramer::GetDataFrameMaximumPayload() const {
- return GetFrameMaximumSize() - GetDataFrameMinimumSize();
+ if (protocol_version_ == HTTP2) {
+ return std::min(kMaxDataPayloadSendSize,
+ GetFrameMaximumSize() - GetDataFrameMinimumSize());
+ } else {
+ return GetFrameMaximumSize() - GetDataFrameMinimumSize();
+ }
}
size_t SpdyFramer::GetPrefixLength(SpdyFrameType type) const {
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | net/spdy/spdy_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698