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

Unified Diff: net/quic/quic_connection.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index f0e061980614c517d6bef8bd335157117c069641..dc2fc9b6668b6e10ac9e7ece4694e76d4e9c5c19 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -64,9 +64,7 @@ bool Near(QuicPacketSequenceNumber a, QuicPacketSequenceNumber b) {
// An alarm that is scheduled to send an ack if a timeout occurs.
class AckAlarm : public QuicAlarm::Delegate {
public:
- explicit AckAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit AckAlarm(QuicConnection* connection) : connection_(connection) {}
virtual QuicTime OnAlarm() OVERRIDE {
connection_->SendAck();
@@ -85,8 +83,7 @@ class AckAlarm : public QuicAlarm::Delegate {
class RetransmissionAlarm : public QuicAlarm::Delegate {
public:
explicit RetransmissionAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ : connection_(connection) {}
virtual QuicTime OnAlarm() OVERRIDE {
connection_->OnRetransmissionTimeout();
@@ -103,9 +100,7 @@ class RetransmissionAlarm : public QuicAlarm::Delegate {
// a delay before sending packets and fires when the packet may be sent.
class SendAlarm : public QuicAlarm::Delegate {
public:
- explicit SendAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit SendAlarm(QuicConnection* connection) : connection_(connection) {}
virtual QuicTime OnAlarm() OVERRIDE {
connection_->WriteIfNotBlocked();
@@ -121,9 +116,7 @@ class SendAlarm : public QuicAlarm::Delegate {
class TimeoutAlarm : public QuicAlarm::Delegate {
public:
- explicit TimeoutAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit TimeoutAlarm(QuicConnection* connection) : connection_(connection) {}
virtual QuicTime OnAlarm() OVERRIDE {
connection_->CheckForTimeout();
@@ -139,9 +132,7 @@ class TimeoutAlarm : public QuicAlarm::Delegate {
class PingAlarm : public QuicAlarm::Delegate {
public:
- explicit PingAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit PingAlarm(QuicConnection* connection) : connection_(connection) {}
virtual QuicTime OnAlarm() OVERRIDE {
connection_->SendPing();
@@ -172,17 +163,19 @@ QuicConnection::PacketType GetPacketType(
QuicConnection::QueuedPacket::QueuedPacket(SerializedPacket packet,
EncryptionLevel level,
TransmissionType transmission_type)
- : sequence_number(packet.sequence_number),
- packet(packet.packet),
- encryption_level(level),
- transmission_type(transmission_type),
- retransmittable((transmission_type != NOT_RETRANSMISSION ||
- packet.retransmittable_frames != NULL) ?
- HAS_RETRANSMITTABLE_DATA : NO_RETRANSMITTABLE_DATA),
- handshake(packet.retransmittable_frames == NULL ?
- NOT_HANDSHAKE : packet.retransmittable_frames->HasCryptoHandshake()),
- type(GetPacketType(packet.retransmittable_frames)),
- length(packet.packet->length()) {
+ : sequence_number(packet.sequence_number),
+ packet(packet.packet),
+ encryption_level(level),
+ transmission_type(transmission_type),
+ retransmittable((transmission_type != NOT_RETRANSMISSION ||
+ packet.retransmittable_frames != NULL)
+ ? HAS_RETRANSMITTABLE_DATA
+ : NO_RETRANSMITTABLE_DATA),
+ handshake(packet.retransmittable_frames == NULL
+ ? NOT_HANDSHAKE
+ : packet.retransmittable_frames->HasCryptoHandshake()),
+ type(GetPacketType(packet.retransmittable_frames)),
+ length(packet.packet->length()) {
}
#define ENDPOINT (is_server_ ? "Server: " : " Client: ")
@@ -194,7 +187,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
bool is_server,
const QuicVersionVector& supported_versions,
uint32 max_flow_control_receive_window_bytes)
- : framer_(supported_versions, helper->GetClock()->ApproximateNow(),
+ : framer_(supported_versions,
+ helper->GetClock()->ApproximateNow(),
is_server),
helper_(helper),
writer_(writer),
@@ -227,9 +221,11 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
time_of_last_received_packet_(clock_->ApproximateNow()),
time_of_last_sent_new_packet_(clock_->ApproximateNow()),
sequence_number_of_last_sent_packet_(0),
- sent_packet_manager_(
- is_server, clock_, &stats_, kTCP,
- FLAGS_quic_use_time_loss_detection ? kTime : kNack),
+ sent_packet_manager_(is_server,
+ clock_,
+ &stats_,
+ kTCP,
+ FLAGS_quic_use_time_loss_detection ? kTime : kNack),
version_negotiation_state_(START_NEGOTIATION),
is_server_(is_server),
connected_(true),
@@ -247,8 +243,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
// Pacing will be enabled if the client negotiates it.
sent_packet_manager_.MaybeEnablePacing();
}
- DVLOG(1) << ENDPOINT << "Created connection with connection_id: "
- << connection_id;
+ DVLOG(1) << ENDPOINT
+ << "Created connection with connection_id: " << connection_id;
timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_));
framer_.set_visitor(this);
framer_.set_received_entropy_calculator(&received_packet_manager_);
@@ -259,7 +255,8 @@ QuicConnection::~QuicConnection() {
STLDeleteElements(&undecryptable_packets_);
STLDeleteValues(&group_map_);
for (QueuedPacketList::iterator it = queued_packets_.begin();
- it != queued_packets_.end(); ++it) {
+ it != queued_packets_.end();
+ ++it) {
delete it->packet;
}
}
@@ -278,7 +275,8 @@ bool QuicConnection::SelectMutualVersion(
const QuicVersionVector& supported_versions = framer_.supported_versions();
for (size_t i = 0; i < supported_versions.size(); ++i) {
const QuicVersion& version = supported_versions[i];
- if (std::find(available_versions.begin(), available_versions.end(),
+ if (std::find(available_versions.begin(),
+ available_versions.end(),
version) != available_versions.end()) {
framer_.set_version(version);
return true;
@@ -298,18 +296,13 @@ void QuicConnection::OnError(QuicFramer* framer) {
}
void QuicConnection::OnPacket() {
- DCHECK(last_stream_frames_.empty() &&
- last_goaway_frames_.empty() &&
- last_window_update_frames_.empty() &&
- last_blocked_frames_.empty() &&
- last_rst_frames_.empty() &&
- last_ack_frames_.empty() &&
- last_congestion_frames_.empty() &&
- last_stop_waiting_frames_.empty());
-}
-
-void QuicConnection::OnPublicResetPacket(
- const QuicPublicResetPacket& packet) {
+ DCHECK(last_stream_frames_.empty() && last_goaway_frames_.empty() &&
+ last_window_update_frames_.empty() && last_blocked_frames_.empty() &&
+ last_rst_frames_.empty() && last_ack_frames_.empty() &&
+ last_congestion_frames_.empty() && last_stop_waiting_frames_.empty());
+}
+
+void QuicConnection::OnPublicResetPacket(const QuicPublicResetPacket& packet) {
if (debug_visitor_) {
debug_visitor_->OnPublicResetPacket(packet);
}
@@ -388,8 +381,7 @@ void QuicConnection::OnVersionNegotiationPacket(
return;
}
- if (std::find(packet.versions.begin(),
- packet.versions.end(), version()) !=
+ if (std::find(packet.versions.begin(), packet.versions.end(), version()) !=
packet.versions.end()) {
DLOG(WARNING) << ENDPOINT << "The server already supports our version. "
<< "It should have accepted our connection.";
@@ -565,8 +557,7 @@ void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) {
// Always reset the retransmission alarm when an ack comes in, since we now
// have a better estimate of the current rtt than when it was set.
retransmission_alarm_->Cancel();
- QuicTime retransmission_time =
- sent_packet_manager_.GetRetransmissionTime();
+ QuicTime retransmission_time = sent_packet_manager_.GetRetransmissionTime();
if (retransmission_time != QuicTime::Zero()) {
retransmission_alarm_->Set(retransmission_time);
}
@@ -631,7 +622,7 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
}
if (incoming_ack.received_info.largest_observed <
- received_packet_manager_.peer_largest_observed_packet()) {
+ received_packet_manager_.peer_largest_observed_packet()) {
DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:"
<< incoming_ack.received_info.largest_observed << " vs "
<< received_packet_manager_.peer_largest_observed_packet();
@@ -648,7 +639,7 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
if (!incoming_ack.received_info.missing_packets.empty() &&
*incoming_ack.received_info.missing_packets.rbegin() >
- incoming_ack.received_info.largest_observed) {
+ incoming_ack.received_info.largest_observed) {
DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: "
<< *incoming_ack.received_info.missing_packets.rbegin()
<< " which is greater than largest observed: "
@@ -658,7 +649,7 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
if (!incoming_ack.received_info.missing_packets.empty() &&
*incoming_ack.received_info.missing_packets.begin() <
- received_packet_manager_.least_packet_awaited_by_peer()) {
+ received_packet_manager_.least_packet_awaited_by_peer()) {
DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: "
<< *incoming_ack.received_info.missing_packets.begin()
<< " which is smaller than least_packet_awaited_by_peer_: "
@@ -676,7 +667,8 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
for (SequenceNumberSet::const_iterator iter =
incoming_ack.received_info.revived_packets.begin();
- iter != incoming_ack.received_info.revived_packets.end(); ++iter) {
+ iter != incoming_ack.received_info.revived_packets.end();
+ ++iter) {
if (!ContainsKey(incoming_ack.received_info.missing_packets, *iter)) {
DLOG(ERROR) << ENDPOINT
<< "Peer specified revived packet which was not missing.";
@@ -697,10 +689,9 @@ bool QuicConnection::ValidateStopWaitingFrame(
return false;
}
- if (stop_waiting.least_unacked >
- last_header_.packet_sequence_number) {
- DLOG(ERROR) << ENDPOINT << "Peer sent least_unacked:"
- << stop_waiting.least_unacked
+ if (stop_waiting.least_unacked > last_header_.packet_sequence_number) {
+ DLOG(ERROR) << ENDPOINT
+ << "Peer sent least_unacked:" << stop_waiting.least_unacked
<< " greater than the enclosing packet sequence number:"
<< last_header_.packet_sequence_number;
return false;
@@ -737,8 +728,8 @@ bool QuicConnection::OnConnectionCloseFrame(
}
DVLOG(1) << ENDPOINT << "Connection " << connection_id()
<< " closed with error "
- << QuicUtils::ErrorToString(frame.error_code)
- << " " << frame.error_details;
+ << QuicUtils::ErrorToString(frame.error_code) << " "
+ << frame.error_details;
last_close_frames_.push_back(frame);
return connected_;
}
@@ -754,16 +745,17 @@ bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) {
bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) {
DCHECK(connected_);
- DVLOG(1) << ENDPOINT << "WindowUpdate received for stream: "
- << frame.stream_id << " with byte offset: " << frame.byte_offset;
+ DVLOG(1) << ENDPOINT
+ << "WindowUpdate received for stream: " << frame.stream_id
+ << " with byte offset: " << frame.byte_offset;
last_window_update_frames_.push_back(frame);
return connected_;
}
bool QuicConnection::OnBlockedFrame(const QuicBlockedFrame& frame) {
DCHECK(connected_);
- DVLOG(1) << ENDPOINT << "Blocked frame received for stream: "
- << frame.stream_id;
+ DVLOG(1) << ENDPOINT
+ << "Blocked frame received for stream: " << frame.stream_id;
last_blocked_frames_.push_back(frame);
return connected_;
}
@@ -776,17 +768,15 @@ void QuicConnection::OnPacketComplete() {
}
DVLOG(1) << ENDPOINT << (last_packet_revived_ ? "Revived" : "Got")
- << " packet " << last_header_.packet_sequence_number
- << " with " << last_ack_frames_.size() << " acks, "
+ << " packet " << last_header_.packet_sequence_number << " with "
+ << last_ack_frames_.size() << " acks, "
<< last_congestion_frames_.size() << " congestions, "
<< last_stop_waiting_frames_.size() << " stop_waiting, "
<< last_goaway_frames_.size() << " goaways, "
<< last_window_update_frames_.size() << " window updates, "
<< last_blocked_frames_.size() << " blocked, "
- << last_rst_frames_.size() << " rsts, "
- << last_close_frames_.size() << " closes, "
- << last_stream_frames_.size()
- << " stream frames for "
+ << last_rst_frames_.size() << " rsts, " << last_close_frames_.size()
+ << " closes, " << last_stream_frames_.size() << " stream frames for "
<< last_header_.public_header.connection_id;
// Call MaybeQueueAck() before recording the received packet, since we want
@@ -855,8 +845,8 @@ void QuicConnection::OnPacketComplete() {
void QuicConnection::MaybeQueueAck() {
// If the incoming packet was missing, send an ack immediately.
- ack_queued_ = received_packet_manager_.IsMissing(
- last_header_.packet_sequence_number);
+ ack_queued_ =
+ received_packet_manager_.IsMissing(last_header_.packet_sequence_number);
if (!ack_queued_ && ShouldLastPacketInstigateAck()) {
if (ack_alarm_->IsSet()) {
@@ -909,10 +899,8 @@ QuicStopWaitingFrame* QuicConnection::CreateStopWaitingFrame() {
}
bool QuicConnection::ShouldLastPacketInstigateAck() const {
- if (!last_stream_frames_.empty() ||
- !last_goaway_frames_.empty() ||
- !last_rst_frames_.empty() ||
- !last_window_update_frames_.empty() ||
+ if (!last_stream_frames_.empty() || !last_goaway_frames_.empty() ||
+ !last_rst_frames_.empty() || !last_window_update_frames_.empty() ||
!last_blocked_frames_.empty()) {
return true;
}
@@ -941,9 +929,9 @@ void QuicConnection::UpdateStopWaitingCount() {
}
QuicPacketSequenceNumber QuicConnection::GetLeastUnacked() const {
- return sent_packet_manager_.HasUnackedPackets() ?
- sent_packet_manager_.GetLeastUnackedSentPacket() :
- packet_creator_.sequence_number() + 1;
+ return sent_packet_manager_.HasUnackedPackets()
+ ? sent_packet_manager_.GetLeastUnackedSentPacket()
+ : packet_creator_.sequence_number() + 1;
}
void QuicConnection::MaybeSendInResponseToPacket() {
@@ -954,9 +942,10 @@ void QuicConnection::MaybeSendInResponseToPacket() {
// Now that we have received an ack, we might be able to send packets which
// are queued locally, or drain streams which are blocked.
- QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend(
- time_of_last_received_packet_, NOT_RETRANSMISSION,
- HAS_RETRANSMITTABLE_DATA);
+ QuicTime::Delta delay =
+ sent_packet_manager_.TimeUntilSend(time_of_last_received_packet_,
+ NOT_RETRANSMISSION,
+ HAS_RETRANSMITTABLE_DATA);
if (delay.IsZero()) {
send_alarm_->Cancel();
WriteIfNotBlocked();
@@ -976,9 +965,10 @@ void QuicConnection::SendVersionNegotiationPacket() {
scoped_ptr<QuicEncryptedPacket> version_packet(
packet_creator_.SerializeVersionNegotiationPacket(
framer_.supported_versions()));
- WriteResult result = writer_->WritePacket(
- version_packet->data(), version_packet->length(),
- self_address().address(), peer_address());
+ WriteResult result = writer_->WritePacket(version_packet->data(),
+ version_packet->length(),
+ self_address().address(),
+ peer_address());
if (result.status == WRITE_STATUS_ERROR) {
// We can't send an error as the socket is presumably borked.
@@ -1129,14 +1119,14 @@ void QuicConnection::OnCanWrite() {
WriteQueuedPackets();
WritePendingRetransmissions();
- IsHandshake pending_handshake = visitor_->HasPendingHandshake() ?
- IS_HANDSHAKE : NOT_HANDSHAKE;
+ IsHandshake pending_handshake =
+ visitor_->HasPendingHandshake() ? IS_HANDSHAKE : NOT_HANDSHAKE;
// Sending queued packets may have caused the socket to become write blocked,
// or the congestion manager to prohibit sending. If we've sent everything
// we had queued and we're still not blocked, let the visitor know it can
// write more.
- if (!CanWrite(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA,
- pending_handshake)) {
+ if (!CanWrite(
+ NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA, pending_handshake)) {
return;
}
@@ -1148,11 +1138,11 @@ void QuicConnection::OnCanWrite() {
// After the visitor writes, it may have caused the socket to become write
// blocked or the congestion manager to prohibit sending, so check again.
- pending_handshake = visitor_->HasPendingHandshake() ?
- IS_HANDSHAKE : NOT_HANDSHAKE;
+ pending_handshake =
+ visitor_->HasPendingHandshake() ? IS_HANDSHAKE : NOT_HANDSHAKE;
if (visitor_->HasPendingWrites() && !resume_writes_alarm_->IsSet() &&
- CanWrite(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA,
- pending_handshake)) {
+ CanWrite(
+ NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA, pending_handshake)) {
// We're not write blocked, but some stream didn't write out all of its
// bytes. Register for 'immediate' resumption so we'll keep writing after
// other connections and events have had a chance to use the thread.
@@ -1212,7 +1202,8 @@ void QuicConnection::WritePendingRetransmissions() {
const QuicSentPacketManager::PendingRetransmission pending =
sent_packet_manager_.NextPendingRetransmission();
if (GetPacketType(&pending.retransmittable_frames) == NORMAL &&
- !CanWrite(pending.transmission_type, HAS_RETRANSMITTABLE_DATA,
+ !CanWrite(pending.transmission_type,
+ HAS_RETRANSMITTABLE_DATA,
pending.retransmittable_frames.HasCryptoHandshake())) {
break;
}
@@ -1232,8 +1223,8 @@ void QuicConnection::WritePendingRetransmissions() {
DVLOG(1) << ENDPOINT << "Retransmitting " << pending.sequence_number
<< " as " << serialized_packet.sequence_number;
if (debug_visitor_) {
- debug_visitor_->OnPacketRetransmitted(
- pending.sequence_number, serialized_packet.sequence_number);
+ debug_visitor_->OnPacketRetransmitted(pending.sequence_number,
+ serialized_packet.sequence_number);
}
sent_packet_manager_.OnRetransmittedPacket(
pending.sequence_number, serialized_packet.sequence_number);
@@ -1310,9 +1301,8 @@ bool QuicConnection::CanWrite(TransmissionType transmission_type,
bool QuicConnection::WritePacket(QueuedPacket packet) {
QuicPacketSequenceNumber sequence_number = packet.sequence_number;
- if (ShouldDiscardPacket(packet.encryption_level,
- sequence_number,
- packet.retransmittable)) {
+ if (ShouldDiscardPacket(
+ packet.encryption_level, sequence_number, packet.retransmittable)) {
++stats_.packets_discarded;
return true;
}
@@ -1323,9 +1313,9 @@ bool QuicConnection::WritePacket(QueuedPacket packet) {
// This ensures packets are sent in sequence number order.
// TODO(ianswett): The congestion control should have been consulted before
// serializing the packet, so this could be turned into a LOG_IF(DFATAL).
- if (packet.type == NORMAL && !CanWrite(packet.transmission_type,
- packet.retransmittable,
- packet.handshake)) {
+ if (packet.type == NORMAL &&
+ !CanWrite(
+ packet.transmission_type, packet.retransmittable, packet.handshake)) {
return false;
}
@@ -1362,23 +1352,25 @@ bool QuicConnection::WritePacket(QueuedPacket packet) {
LOG_IF(DFATAL, encrypted->length() > options()->max_packet_length)
<< "Writing an encrypted packet larger than max_packet_length:"
- << options()->max_packet_length << " encrypted length: "
- << encrypted->length();
- DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number
- << " : " << (packet.packet->is_fec_packet() ? "FEC " :
- (packet.retransmittable == HAS_RETRANSMITTABLE_DATA
- ? "data bearing " : " ack only "))
- << ", encryption level: "
+ << options()->max_packet_length
+ << " encrypted length: " << encrypted->length();
+ DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number << " : "
+ << (packet.packet->is_fec_packet()
+ ? "FEC "
+ : (packet.retransmittable == HAS_RETRANSMITTABLE_DATA
+ ? "data bearing "
+ : " ack only ")) << ", encryption level: "
<< QuicUtils::EncryptionLevelToString(packet.encryption_level)
- << ", length:" << packet.packet->length() << ", encrypted length:"
- << encrypted->length();
+ << ", length:" << packet.packet->length()
+ << ", encrypted length:" << encrypted->length();
DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl
<< QuicUtils::StringToHexASCIIDump(packet.packet->AsStringPiece());
DCHECK(encrypted->length() <= kMaxPacketSize ||
FLAGS_quic_allow_oversized_packets_for_test)
- << "Packet " << sequence_number << " will not be read; too large: "
- << packet.packet->length() << " " << encrypted->length() << " "
+ << "Packet " << sequence_number
+ << " will not be read; too large: " << packet.packet->length() << " "
+ << encrypted->length() << " "
<< " close: " << (packet.type == CONNECTION_CLOSE ? "yes" : "no");
DCHECK(pending_write_.get() == NULL);
@@ -1423,8 +1415,7 @@ bool QuicConnection::ShouldDiscardPacket(
QuicPacketSequenceNumber sequence_number,
HasRetransmittableData retransmittable) {
if (!connected_) {
- DVLOG(1) << ENDPOINT
- << "Not sending packet as connection is disconnected.";
+ DVLOG(1) << ENDPOINT << "Not sending packet as connection is disconnected.";
return true;
}
@@ -1441,8 +1432,9 @@ bool QuicConnection::ShouldDiscardPacket(
// If the packet has been discarded before sending, don't send it.
// This occurs if a packet gets serialized, queued, then discarded.
if (!sent_packet_manager_.IsUnacked(sequence_number)) {
- DVLOG(1) << ENDPOINT << "Dropping packet before sending: "
- << sequence_number << " since it has already been discarded.";
+ DVLOG(1) << ENDPOINT
+ << "Dropping packet before sending: " << sequence_number
+ << " since it has already been discarded.";
return true;
}
@@ -1465,7 +1457,7 @@ bool QuicConnection::OnPacketSent(WriteResult result) {
}
QuicPacketSequenceNumber sequence_number = pending_write_->sequence_number;
- TransmissionType transmission_type = pending_write_->transmission_type;
+ TransmissionType transmission_type = pending_write_->transmission_type;
HasRetransmittableData retransmittable = pending_write_->retransmittable;
size_t length = pending_write_->length;
pending_write_.reset();
@@ -1483,8 +1475,8 @@ bool QuicConnection::OnPacketSent(WriteResult result) {
time_of_last_sent_new_packet_ = now;
}
SetPingAlarm();
- DVLOG(1) << ENDPOINT << "time of last sent packet: "
- << now.ToDebuggingValue();
+ DVLOG(1) << ENDPOINT
+ << "time of last sent packet: " << now.ToDebuggingValue();
// TODO(ianswett): Change the sequence number length and other packet creator
// options by a more explicit API than setting a struct value directly.
@@ -1492,9 +1484,8 @@ bool QuicConnection::OnPacketSent(WriteResult result) {
received_packet_manager_.least_packet_awaited_by_peer(),
sent_packet_manager_.GetCongestionWindow());
- bool reset_retransmission_alarm =
- sent_packet_manager_.OnPacketSent(sequence_number, now, length,
- transmission_type, retransmittable);
+ bool reset_retransmission_alarm = sent_packet_manager_.OnPacketSent(
+ sequence_number, now, length, transmission_type, retransmittable);
if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) {
retransmission_alarm_->Cancel();
@@ -1518,15 +1509,14 @@ bool QuicConnection::OnPacketSent(WriteResult result) {
bool QuicConnection::OnSerializedPacket(
const SerializedPacket& serialized_packet) {
if (serialized_packet.retransmittable_frames) {
- serialized_packet.retransmittable_frames->
- set_encryption_level(encryption_level_);
+ serialized_packet.retransmittable_frames->set_encryption_level(
+ encryption_level_);
}
sent_packet_manager_.OnSerializedPacket(serialized_packet);
// The TransmissionType is NOT_RETRANSMISSION because all retransmissions
// serialize packets and invoke SendOrQueuePacket directly.
- return SendOrQueuePacket(encryption_level_,
- serialized_packet,
- NOT_RETRANSMISSION);
+ return SendOrQueuePacket(
+ encryption_level_, serialized_packet, NOT_RETRANSMISSION);
}
bool QuicConnection::SendOrQueuePacket(EncryptionLevel level,
@@ -1554,8 +1544,8 @@ bool QuicConnection::SendOrQueuePacket(EncryptionLevel level,
void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) {
stop_waiting->least_unacked = GetLeastUnacked();
- stop_waiting->entropy_hash = sent_entropy_manager_.EntropyHash(
- stop_waiting->least_unacked - 1);
+ stop_waiting->entropy_hash =
+ sent_entropy_manager_.EntropyHash(stop_waiting->least_unacked - 1);
}
void QuicConnection::SendPing() {
@@ -1587,8 +1577,8 @@ void QuicConnection::SendAck() {
bool send_feedback = false;
if (received_packet_manager_.GenerateCongestionFeedback(
&outgoing_congestion_feedback_)) {
- DVLOG(1) << ENDPOINT << "Sending feedback: "
- << outgoing_congestion_feedback_;
+ DVLOG(1) << ENDPOINT
+ << "Sending feedback: " << outgoing_congestion_feedback_;
send_feedback = true;
}
@@ -1751,9 +1741,9 @@ void QuicConnection::SendConnectionCloseWithDetails(QuicErrorCode error,
void QuicConnection::SendConnectionClosePacket(QuicErrorCode error,
const string& details) {
- DVLOG(1) << ENDPOINT << "Force closing " << connection_id()
- << " with error " << QuicUtils::ErrorToString(error)
- << " (" << error << ") " << details;
+ DVLOG(1) << ENDPOINT << "Force closing " << connection_id() << " with error "
+ << QuicUtils::ErrorToString(error) << " (" << error << ") "
+ << details;
ScopedPacketBundler ack_bundler(this, SEND_ACK);
QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame();
frame->error_code = error;
@@ -1783,8 +1773,7 @@ void QuicConnection::SendGoAway(QuicErrorCode error,
QuicStreamId last_good_stream_id,
const string& reason) {
DVLOG(1) << ENDPOINT << "Going away with error "
- << QuicUtils::ErrorToString(error)
- << " (" << error << ")";
+ << QuicUtils::ErrorToString(error) << " (" << error << ")";
// Opportunistically bundle an ack with this outgoing packet.
ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK);
@@ -1818,8 +1807,8 @@ void QuicConnection::Flush() {
}
bool QuicConnection::HasQueuedData() const {
- return pending_version_negotiation_packet_ ||
- !queued_packets_.empty() || packet_generator_.HasQueuedFrames();
+ return pending_version_negotiation_packet_ || !queued_packets_.empty() ||
+ packet_generator_.HasQueuedFrames();
}
bool QuicConnection::CanWriteStreamData() {
@@ -1829,14 +1818,14 @@ bool QuicConnection::CanWriteStreamData() {
return false;
}
- IsHandshake pending_handshake = visitor_->HasPendingHandshake() ?
- IS_HANDSHAKE : NOT_HANDSHAKE;
+ IsHandshake pending_handshake =
+ visitor_->HasPendingHandshake() ? IS_HANDSHAKE : NOT_HANDSHAKE;
// Sending queued packets may have caused the socket to become write blocked,
// or the congestion manager to prohibit sending. If we've sent everything
// we had queued and we're still not blocked, let the visitor know it can
// write more.
- return ShouldGeneratePacket(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA,
- pending_handshake);
+ return ShouldGeneratePacket(
+ NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA, pending_handshake);
}
void QuicConnection::SetIdleNetworkTimeout(QuicTime::Delta timeout) {
@@ -1859,8 +1848,8 @@ void QuicConnection::SetOverallConnectionTimeout(QuicTime::Delta timeout) {
bool QuicConnection::CheckForTimeout() {
QuicTime now = clock_->ApproximateNow();
- QuicTime time_of_last_packet = max(time_of_last_received_packet_,
- time_of_last_sent_new_packet_);
+ QuicTime time_of_last_packet =
+ max(time_of_last_received_packet_, time_of_last_sent_new_packet_);
// |delta| can be < 0 as |now| is approximate time but |time_of_last_packet|
// is accurate time. However, this should not change the behavior of
@@ -1883,12 +1872,13 @@ bool QuicConnection::CheckForTimeout() {
if (!overall_connection_timeout_.IsInfinite()) {
QuicTime::Delta connected_time =
now.Subtract(stats_.connection_creation_time);
- DVLOG(1) << ENDPOINT << "connection time: "
- << connected_time.ToMilliseconds() << " overall timeout: "
+ DVLOG(1) << ENDPOINT
+ << "connection time: " << connected_time.ToMilliseconds()
+ << " overall timeout: "
<< overall_connection_timeout_.ToMilliseconds();
if (connected_time >= overall_connection_timeout_) {
- DVLOG(1) << ENDPOINT <<
- "Connection timedout due to overall connection timeout.";
+ DVLOG(1) << ENDPOINT
+ << "Connection timedout due to overall connection timeout.";
SendConnectionClose(QUIC_CONNECTION_TIMED_OUT);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698