Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index 8a2f8b4eaa6a25a6e50796fc4360185f8b5cf124..3db64bb0c83d53cd17513ba1425064835a9a234e 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -96,7 +96,6 @@ class VisitorShim : public QuicConnectionVisitorInterface { |
}; |
QuicSession::QuicSession(QuicConnection* connection, |
- uint32 max_flow_control_receive_window_bytes, |
const QuicConfig& config) |
: connection_(connection), |
visitor_shim_(new VisitorShim(this)), |
@@ -107,20 +106,11 @@ QuicSession::QuicSession(QuicConnection* connection, |
error_(QUIC_NO_ERROR), |
goaway_received_(false), |
goaway_sent_(false), |
- has_pending_handshake_(false), |
- max_flow_control_receive_window_bytes_( |
- max_flow_control_receive_window_bytes) { |
- if (max_flow_control_receive_window_bytes_ < kDefaultFlowControlSendWindow) { |
- LOG(ERROR) << "Initial receive window (" |
- << max_flow_control_receive_window_bytes_ |
- << ") cannot be set lower than default (" |
- << kDefaultFlowControlSendWindow << ")."; |
- max_flow_control_receive_window_bytes_ = kDefaultFlowControlSendWindow; |
- } |
+ has_pending_handshake_(false) { |
flow_controller_.reset(new QuicFlowController( |
connection_.get(), 0, is_server(), kDefaultFlowControlSendWindow, |
- max_flow_control_receive_window_bytes_, |
- max_flow_control_receive_window_bytes_)); |
+ config_.GetInitialFlowControlWindowToSend(), |
+ config_.GetInitialFlowControlWindowToSend())); |
connection_->set_visitor(visitor_shim_.get()); |
connection_->SetFromConfig(config_); |
@@ -477,26 +467,42 @@ 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; |
+ } |
+ |
+ DataStreamMap::iterator it = stream_map_.begin(); |
+ while (it != stream_map_.end()) { |
+ it->second->flow_controller()->UpdateSendWindowOffset(new_window); |
+ it++; |
wtc
2014/06/16 19:35:56
Nit: ++it is more efficient.
You can also write t
ramant (doing other things)
2014/06/16 21:13:53
Done.
|
+ } |
+} |
- // Update connection level window. |
- flow_controller_->UpdateSendWindowOffset(new_flow_control_send_window); |
+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) { |