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

Side by Side Diff: net/quic/quic_connection.cc

Issue 17518002: Add logging to the QUIC write path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 guid_(guid), 76 guid_(guid),
77 peer_address_(address), 77 peer_address_(address),
78 largest_seen_packet_with_ack_(0), 78 largest_seen_packet_with_ack_(0),
79 peer_largest_observed_packet_(0), 79 peer_largest_observed_packet_(0),
80 least_packet_awaited_by_peer_(1), 80 least_packet_awaited_by_peer_(1),
81 peer_least_packet_awaiting_ack_(0), 81 peer_least_packet_awaiting_ack_(0),
82 handling_retransmission_timeout_(false), 82 handling_retransmission_timeout_(false),
83 write_blocked_(false), 83 write_blocked_(false),
84 debug_visitor_(NULL), 84 debug_visitor_(NULL),
85 packet_creator_(guid_, &framer_, random_generator_, is_server), 85 packet_creator_(guid_, &framer_, random_generator_, is_server),
86 packet_generator_(this, &packet_creator_), 86 packet_generator_(this, NULL, &packet_creator_),
87 idle_network_timeout_( 87 idle_network_timeout_(
88 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)), 88 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)),
89 overall_connection_timeout_(QuicTime::Delta::Infinite()), 89 overall_connection_timeout_(QuicTime::Delta::Infinite()),
90 creation_time_(clock_->ApproximateNow()), 90 creation_time_(clock_->ApproximateNow()),
91 time_of_last_received_packet_(clock_->ApproximateNow()), 91 time_of_last_received_packet_(clock_->ApproximateNow()),
92 time_of_last_sent_packet_(clock_->ApproximateNow()), 92 time_of_last_sent_packet_(clock_->ApproximateNow()),
93 time_largest_observed_(QuicTime::Zero()), 93 time_largest_observed_(QuicTime::Zero()),
94 congestion_manager_(clock_, kTCP), 94 congestion_manager_(clock_, kTCP),
95 version_negotiation_state_(START_NEGOTIATION), 95 version_negotiation_state_(START_NEGOTIATION),
96 quic_version_(kQuicVersion1), 96 quic_version_(kQuicVersion1),
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl 1084 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl
1085 << QuicUtils::StringToHexASCIIDump(packet->AsStringPiece()); 1085 << QuicUtils::StringToHexASCIIDump(packet->AsStringPiece());
1086 1086
1087 DCHECK(encrypted->length() <= kMaxPacketSize) 1087 DCHECK(encrypted->length() <= kMaxPacketSize)
1088 << "Packet " << sequence_number << " will not be read; too large: " 1088 << "Packet " << sequence_number << " will not be read; too large: "
1089 << packet->length() << " " << encrypted->length() << " " 1089 << packet->length() << " " << encrypted->length() << " "
1090 << outgoing_ack_ << " forced: " << (forced == FORCE ? "yes" : "no"); 1090 << outgoing_ack_ << " forced: " << (forced == FORCE ? "yes" : "no");
1091 1091
1092 int error; 1092 int error;
1093 QuicTime now = clock_->Now(); 1093 QuicTime now = clock_->Now();
1094 if (helper_->WritePacketToWire(*encrypted, &error) == -1) { 1094 if (WritePacketToWire(sequence_number, level, *encrypted, &error) == -1) {
1095 if (helper_->IsWriteBlocked(error)) { 1095 if (helper_->IsWriteBlocked(error)) {
1096 // TODO(satyashekhar): It might be more efficient (fewer system calls), if 1096 // TODO(satyashekhar): It might be more efficient (fewer system calls), if
1097 // all connections share this variable i.e this becomes a part of 1097 // all connections share this variable i.e this becomes a part of
1098 // PacketWriterInterface. 1098 // PacketWriterInterface.
1099 write_blocked_ = true; 1099 write_blocked_ = true;
1100 // If the socket buffers the the data, then the packet should not 1100 // If the socket buffers the the data, then the packet should not
1101 // be queued and sent again, which would result in an unnecessary 1101 // be queued and sent again, which would result in an unnecessary
1102 // duplicate packet being sent. 1102 // duplicate packet being sent.
1103 return helper_->IsWriteBlockedDataBuffered(); 1103 return helper_->IsWriteBlockedDataBuffered();
1104 } 1104 }
(...skipping 24 matching lines...) Expand all
1129 1129
1130 if (retransmission == IS_RETRANSMISSION) { 1130 if (retransmission == IS_RETRANSMISSION) {
1131 stats_.bytes_retransmitted += encrypted->length(); 1131 stats_.bytes_retransmitted += encrypted->length();
1132 ++stats_.packets_retransmitted; 1132 ++stats_.packets_retransmitted;
1133 } 1133 }
1134 1134
1135 delete packet; 1135 delete packet;
1136 return true; 1136 return true;
1137 } 1137 }
1138 1138
1139 int QuicConnection::WritePacketToWire(QuicPacketSequenceNumber sequence_number,
1140 EncryptionLevel level,
1141 const QuicEncryptedPacket& packet,
1142 int* error) {
1143 int rv = helper_->WritePacketToWire(packet, error);
1144 if (debug_visitor_) {
1145 debug_visitor_->OnPacketSent(sequence_number, level, packet,
1146 rv == -1 ? *error : rv);
eroman 2013/06/20 22:20:04 What is the range of |*error|? Is it a NetError c
Ryan Hamilton 2013/06/20 22:44:16 -1 == error, otherwise positive values equal the n
1147 }
1148 return rv;
1149 }
1150
1139 bool QuicConnection::OnSerializedPacket( 1151 bool QuicConnection::OnSerializedPacket(
1140 const SerializedPacket& serialized_packet) { 1152 const SerializedPacket& serialized_packet) {
1141 if (serialized_packet.retransmittable_frames != NULL) { 1153 if (serialized_packet.retransmittable_frames != NULL) {
1142 DCHECK(unacked_packets_.empty() || 1154 DCHECK(unacked_packets_.empty() ||
1143 unacked_packets_.rbegin()->first < 1155 unacked_packets_.rbegin()->first <
1144 serialized_packet.sequence_number); 1156 serialized_packet.sequence_number);
1145 // Retransmitted frames will be sent with the same encryption level as the 1157 // Retransmitted frames will be sent with the same encryption level as the
1146 // original. 1158 // original.
1147 serialized_packet.retransmittable_frames->set_encryption_level( 1159 serialized_packet.retransmittable_frames->set_encryption_level(
1148 encryption_level_); 1160 encryption_level_);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 if (connection_timeout < timeout) { 1509 if (connection_timeout < timeout) {
1498 timeout = connection_timeout; 1510 timeout = connection_timeout;
1499 } 1511 }
1500 } 1512 }
1501 1513
1502 helper_->SetTimeoutAlarm(timeout); 1514 helper_->SetTimeoutAlarm(timeout);
1503 return false; 1515 return false;
1504 } 1516 }
1505 1517
1506 } // namespace net 1518 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698