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

Side by Side Diff: net/spdy/spdy_session.cc

Issue 959743002: Account for HTTP/2 padding in receive windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more mock implementation. Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 DCHECK(buffered_spdy_framer_); 2038 DCHECK(buffered_spdy_framer_);
2039 size_t header_len = buffered_spdy_framer_->GetDataFrameMinimumSize(); 2039 size_t header_len = buffered_spdy_framer_->GetDataFrameMinimumSize();
2040 stream->IncrementRawReceivedBytes(header_len); 2040 stream->IncrementRawReceivedBytes(header_len);
2041 } 2041 }
2042 2042
2043 void SpdySession::OnStreamFrameData(SpdyStreamId stream_id, 2043 void SpdySession::OnStreamFrameData(SpdyStreamId stream_id,
2044 const char* data, 2044 const char* data,
2045 size_t len, 2045 size_t len,
2046 bool fin) { 2046 bool fin) {
2047 CHECK(in_io_loop_); 2047 CHECK(in_io_loop_);
2048
2049 if (data == NULL && len != 0) {
2050 // This is notification of consumed data padding.
2051 // TODO(jgraettinger): Properly flow padding into WINDOW_UPDATE frames.
2052 // See crbug.com/353012.
2053 return;
2054 }
2055
2056 DCHECK_LT(len, 1u << 24); 2048 DCHECK_LT(len, 1u << 24);
2057 if (net_log().IsLogging()) { 2049 if (net_log().IsLogging()) {
2058 net_log().AddEvent( 2050 net_log().AddEvent(
2059 NetLog::TYPE_HTTP2_SESSION_RECV_DATA, 2051 NetLog::TYPE_HTTP2_SESSION_RECV_DATA,
2060 base::Bind(&NetLogSpdyDataCallback, stream_id, len, fin)); 2052 base::Bind(&NetLogSpdyDataCallback, stream_id, len, fin));
2061 } 2053 }
2062 2054
2063 // Build the buffer as early as possible so that we go through the 2055 // Build the buffer as early as possible so that we go through the
2064 // session flow control checks and update 2056 // session flow control checks and update
2065 // |unacked_recv_window_bytes_| properly even when the stream is 2057 // |unacked_recv_window_bytes_| properly even when the stream is
(...skipping 29 matching lines...) Expand all
2095 if (it->second.waiting_for_syn_reply) { 2087 if (it->second.waiting_for_syn_reply) {
2096 const std::string& error = "Data received before SYN_REPLY."; 2088 const std::string& error = "Data received before SYN_REPLY.";
2097 stream->LogStreamError(ERR_SPDY_PROTOCOL_ERROR, error); 2089 stream->LogStreamError(ERR_SPDY_PROTOCOL_ERROR, error);
2098 ResetStreamIterator(it, RST_STREAM_PROTOCOL_ERROR, error); 2090 ResetStreamIterator(it, RST_STREAM_PROTOCOL_ERROR, error);
2099 return; 2091 return;
2100 } 2092 }
2101 2093
2102 stream->OnDataReceived(buffer.Pass()); 2094 stream->OnDataReceived(buffer.Pass());
2103 } 2095 }
2104 2096
2097 void SpdySession::OnStreamPadding(SpdyStreamId stream_id, size_t len) {
2098 CHECK(in_io_loop_);
2099
2100 if (flow_control_state_ != FLOW_CONTROL_STREAM_AND_SESSION)
2101 return;
2102
2103 // Decrease window size because padding bytes are received.
2104 // Increase window size because padding bytes are consumed (by discarding).
2105 // Net result: |session_unacked_recv_window_bytes_| increases by |len|,
2106 // |session_recv_window_size_| does not change.
2107 DecreaseRecvWindowSize(static_cast<int32>(len));
2108 IncreaseRecvWindowSize(static_cast<int32>(len));
2109
2110 ActiveStreamMap::iterator it = active_streams_.find(stream_id);
2111 if (it == active_streams_.end())
2112 return;
2113 it->second.stream->OnPaddingConsumed(len);
2114 }
2115
2105 void SpdySession::OnSettings(bool clear_persisted) { 2116 void SpdySession::OnSettings(bool clear_persisted) {
2106 CHECK(in_io_loop_); 2117 CHECK(in_io_loop_);
2107 2118
2108 if (clear_persisted) 2119 if (clear_persisted)
2109 http_server_properties_->ClearSpdySettings(host_port_pair()); 2120 http_server_properties_->ClearSpdySettings(host_port_pair());
2110 2121
2111 if (net_log_.IsLogging()) { 2122 if (net_log_.IsLogging()) {
2112 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS, 2123 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS,
2113 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(), 2124 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(),
2114 clear_persisted)); 2125 clear_persisted));
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 if (!queue->empty()) { 3270 if (!queue->empty()) {
3260 SpdyStreamId stream_id = queue->front(); 3271 SpdyStreamId stream_id = queue->front();
3261 queue->pop_front(); 3272 queue->pop_front();
3262 return stream_id; 3273 return stream_id;
3263 } 3274 }
3264 } 3275 }
3265 return 0; 3276 return 0;
3266 } 3277 }
3267 3278
3268 } // namespace net 3279 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698