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

Unified Diff: net/quic/quic_connection.cc

Issue 903973002: Minor cleanup and optimization of QuicConnection::IsConnectionClose. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Rename_QuicAckNotifier_84624660
Patch Set: Created 5 years, 10 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
« no previous file with comments | « net/quic/quic_connection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index 454a15b59b5780745b593b603b0c4c06aa0d8bf2..be82bff04eb1d1a116fc1142f9d4dee580287a47 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -1403,7 +1403,8 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
return true;
}
// Connection close packets are encrypted and saved, so don't exit early.
- if (writer_->IsWriteBlocked() && !IsConnectionClose(*packet)) {
+ const bool is_connection_close = IsConnectionClose(*packet);
+ if (writer_->IsWriteBlocked() && !is_connection_close) {
return false;
}
@@ -1427,7 +1428,7 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
// Connection close packets are eventually owned by TimeWaitListManager.
// Others are deleted at the end of this call.
scoped_ptr<QuicEncryptedPacket> encrypted_deleter;
- if (IsConnectionClose(*packet)) {
+ if (is_connection_close) {
DCHECK(connection_close_packet_.get() == nullptr);
connection_close_packet_.reset(encrypted);
// This assures we won't try to write *forced* packets when blocked.
@@ -2104,15 +2105,14 @@ HasRetransmittableData QuicConnection::IsRetransmittable(
}
}
-bool QuicConnection::IsConnectionClose(
- QueuedPacket packet) {
- RetransmittableFrames* retransmittable_frames =
+bool QuicConnection::IsConnectionClose(const QueuedPacket& packet) {
+ const RetransmittableFrames* retransmittable_frames =
packet.serialized_packet.retransmittable_frames;
- if (!retransmittable_frames) {
+ if (retransmittable_frames == nullptr) {
return false;
}
- for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) {
- if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) {
+ for (const QuicFrame& frame : retransmittable_frames->frames()) {
+ if (frame.type == CONNECTION_CLOSE_FRAME) {
return true;
}
}
« no previous file with comments | « net/quic/quic_connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698