Commit 7afc2ebe authored by rtenneti@chromium.org's avatar rtenneti@chromium.org

QUIC - minor cleanup changes.

  + Fixed indentation.
  + Added early returns.
  + Fixed comments.
  + Removed not needed virtual.

Fixed nit comments from wtc for the following CLs.

  https://codereview.chromium.org/368803003/
  https://codereview.chromium.org/366863002/
  https://codereview.chromium.org/393953011/

R=wtc@chromium.org

Review URL: https://codereview.chromium.org/394053003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284109 0039d316-1c4b-4281-b951-d872f2087c98
parent 1f23e73c
......@@ -514,7 +514,7 @@ class NET_EXPORT_PRIVATE QuicConnection
bool peer_port_changed() const { return peer_port_changed_; }
const QuicReceivedPacketManager& received_packet_manager() {
const QuicReceivedPacketManager& received_packet_manager() const {
return received_packet_manager_;
}
......
......@@ -107,7 +107,7 @@ void QuicCryptoClientStream::OnHandshakeMessage(
// |message| is an update from the server, so we treat it differently from a
// handshake message.
HandleServerConfigUpdateMessage(&message);
HandleServerConfigUpdateMessage(message);
return;
}
......@@ -135,13 +135,13 @@ bool QuicCryptoClientStream::WasChannelIDSent() const {
}
void QuicCryptoClientStream::HandleServerConfigUpdateMessage(
const CryptoHandshakeMessage* in) {
DCHECK(in->tag() == kSCUP);
const CryptoHandshakeMessage& server_config_update) {
DCHECK(server_config_update.tag() == kSCUP);
string error_details;
QuicCryptoClientConfig::CachedState* cached =
crypto_config_->LookupOrCreate(server_id_);
QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate(
*in,
server_config_update,
session()->connection()->clock()->WallNow(),
cached,
&crypto_negotiated_params_,
......
......@@ -106,7 +106,8 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
// Handles new server config and optional source-address token provided by the
// server during a connection.
void HandleServerConfigUpdateMessage(const CryptoHandshakeMessage* in);
void HandleServerConfigUpdateMessage(
const CryptoHandshakeMessage& server_config_update);
// DoHandshakeLoop performs a step of the handshake state machine. Note that
// |in| may be NULL if the call did not result from a received message.
......
......@@ -279,8 +279,8 @@ enum QuicVersion {
QUIC_VERSION_15 = 15, // Revived packets in ReceivedPacketInfo.
QUIC_VERSION_16 = 16, // STOP_WAITING frame.
QUIC_VERSION_18 = 18, // PING frame.
QUIC_VERSION_19 = 19, // Session level flow control.
QUIC_VERSION_20 = 20, // Independent stream/session flow control windows.
QUIC_VERSION_19 = 19, // Connection level flow control.
QUIC_VERSION_20 = 20, // Independent stream/connection flow control windows.
QUIC_VERSION_21 = 21, // Headers/crypto streams are flow controlled.
};
......
......@@ -333,14 +333,14 @@ void ReliableQuicStream::OnCanWrite() {
void ReliableQuicStream::MaybeSendBlocked() {
flow_controller_.MaybeSendBlocked();
if (stream_contributes_to_connection_flow_control_) {
connection_flow_controller_->MaybeSendBlocked();
if (!stream_contributes_to_connection_flow_control_) {
return;
}
connection_flow_controller_->MaybeSendBlocked();
// If we are connection level flow control blocked, then add the stream
// to the write blocked list. It will be given a chance to write when a
// connection level WINDOW_UPDATE arrives.
if (stream_contributes_to_connection_flow_control_ &&
connection_flow_controller_->IsBlocked() &&
if (connection_flow_controller_->IsBlocked() &&
!flow_controller_.IsBlocked()) {
session_->MarkWriteBlocked(id(), EffectivePriority());
}
......@@ -490,22 +490,24 @@ void ReliableQuicStream::OnWindowUpdateFrame(
}
bool ReliableQuicStream::MaybeIncreaseHighestReceivedOffset(uint64 new_offset) {
if (flow_controller_.IsEnabled()) {
uint64 increment =
new_offset - flow_controller_.highest_received_byte_offset();
if (flow_controller_.UpdateHighestReceivedOffset(new_offset)) {
// If |new_offset| increased the stream flow controller's highest received
// offset, then we need to increase the connection flow controller's value
// by the incremental difference.
if (stream_contributes_to_connection_flow_control_) {
connection_flow_controller_->UpdateHighestReceivedOffset(
connection_flow_controller_->highest_received_byte_offset() +
increment);
}
return true;
}
if (!flow_controller_.IsEnabled()) {
return false;
}
return false;
uint64 increment =
new_offset - flow_controller_.highest_received_byte_offset();
if (!flow_controller_.UpdateHighestReceivedOffset(new_offset)) {
return false;
}
// If |new_offset| increased the stream flow controller's highest received
// offset, then we need to increase the connection flow controller's value
// by the incremental difference.
if (stream_contributes_to_connection_flow_control_) {
connection_flow_controller_->UpdateHighestReceivedOffset(
connection_flow_controller_->highest_received_byte_offset() +
increment);
}
return true;
}
void ReliableQuicStream::AddBytesSent(uint64 bytes) {
......@@ -531,11 +533,11 @@ void ReliableQuicStream::AddBytesConsumed(uint64 bytes) {
}
bool ReliableQuicStream::IsFlowControlBlocked() {
bool stream_flow_control_blocked = flow_controller_.IsBlocked();
bool connecton_flow_control_blocked =
stream_contributes_to_connection_flow_control_ &&
if (flow_controller_.IsBlocked()) {
return true;
}
return stream_contributes_to_connection_flow_control_ &&
connection_flow_controller_->IsBlocked();
return stream_flow_control_blocked || connecton_flow_control_blocked;
}
} // namespace net
......@@ -1325,7 +1325,7 @@ TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) {
QuicFlowController* server_connection_flow_controller =
session->flow_controller();
EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::ReceiveWindowSize(
server_connection_flow_controller));
server_connection_flow_controller));
server_thread_->Resume();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment