Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index 352a9635dedbda9dda638109a56f093c7b33aceb..3db64bb0c83d53cd17513ba1425064835a9a234e 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -467,28 +467,44 @@ void QuicSession::OnConfigNegotiated() { |
config_.HasReceivedInitialFlowControlWindowBytes()) { |
// Streams which were created before the SHLO was received (0RTT requests) |
// are now informed of the peer's initial flow control window. |
- uint32 new_flow_control_send_window = |
- config_.ReceivedInitialFlowControlWindowBytes(); |
- if (new_flow_control_send_window < kDefaultFlowControlSendWindow) { |
- LOG(ERROR) |
- << "Peer sent us an invalid flow control send window: " |
- << new_flow_control_send_window |
- << ", below default: " << kDefaultFlowControlSendWindow; |
+ uint32 new_window = config_.ReceivedInitialFlowControlWindowBytes(); |
+ OnNewStreamFlowControlWindow(new_window); |
+ OnNewSessionFlowControlWindow(new_window); |
+ } |
+} |
+ |
+void QuicSession::OnNewStreamFlowControlWindow(uint32 new_window) { |
+ if (new_window < kDefaultFlowControlSendWindow) { |
+ LOG(ERROR) |
+ << "Peer sent us an invalid stream flow control send window: " |
+ << new_window << ", below default: " << kDefaultFlowControlSendWindow; |
+ if (connection_->connected()) { |
connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); |
- return; |
- } |
- DataStreamMap::iterator it = stream_map_.begin(); |
- while (it != stream_map_.end()) { |
- it->second->flow_controller()->UpdateSendWindowOffset( |
- new_flow_control_send_window); |
- it++; |
} |
+ return; |
+ } |
- // Update connection level window. |
- flow_controller_->UpdateSendWindowOffset(new_flow_control_send_window); |
+ DataStreamMap::iterator it = stream_map_.begin(); |
+ while (it != stream_map_.end()) { |
+ it->second->flow_controller()->UpdateSendWindowOffset(new_window); |
+ it++; |
} |
} |
+void QuicSession::OnNewSessionFlowControlWindow(uint32 new_window) { |
+ if (new_window < kDefaultFlowControlSendWindow) { |
+ LOG(ERROR) |
+ << "Peer sent us an invalid session flow control send window: " |
+ << new_window << ", below default: " << kDefaultFlowControlSendWindow; |
+ if (connection_->connected()) { |
+ connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); |
+ } |
+ return; |
+ } |
+ |
+ flow_controller_->UpdateSendWindowOffset(new_window); |
+} |
+ |
void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
switch (event) { |
// TODO(satyamshekhar): Move the logic of setting the encrypter/decrypter |