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

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: Missed one 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
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_logger.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 guid_(guid), 80 guid_(guid),
81 peer_address_(address), 81 peer_address_(address),
82 largest_seen_packet_with_ack_(0), 82 largest_seen_packet_with_ack_(0),
83 peer_largest_observed_packet_(0), 83 peer_largest_observed_packet_(0),
84 least_packet_awaited_by_peer_(1), 84 least_packet_awaited_by_peer_(1),
85 peer_least_packet_awaiting_ack_(0), 85 peer_least_packet_awaiting_ack_(0),
86 handling_retransmission_timeout_(false), 86 handling_retransmission_timeout_(false),
87 write_blocked_(false), 87 write_blocked_(false),
88 debug_visitor_(NULL), 88 debug_visitor_(NULL),
89 packet_creator_(guid_, &framer_, random_generator_, is_server), 89 packet_creator_(guid_, &framer_, random_generator_, is_server),
90 packet_generator_(this, &packet_creator_), 90 packet_generator_(this, NULL, &packet_creator_),
91 idle_network_timeout_( 91 idle_network_timeout_(
92 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)), 92 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)),
93 overall_connection_timeout_(QuicTime::Delta::Infinite()), 93 overall_connection_timeout_(QuicTime::Delta::Infinite()),
94 creation_time_(clock_->ApproximateNow()), 94 creation_time_(clock_->ApproximateNow()),
95 time_of_last_received_packet_(clock_->ApproximateNow()), 95 time_of_last_received_packet_(clock_->ApproximateNow()),
96 time_of_last_sent_packet_(clock_->ApproximateNow()), 96 time_of_last_sent_packet_(clock_->ApproximateNow()),
97 time_largest_observed_(QuicTime::Zero()), 97 time_largest_observed_(QuicTime::Zero()),
98 congestion_manager_(clock_, kTCP), 98 congestion_manager_(clock_, kTCP),
99 version_negotiation_state_(START_NEGOTIATION), 99 version_negotiation_state_(START_NEGOTIATION),
100 quic_version_(kQuicVersion1), 100 quic_version_(kQuicVersion1),
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl 1104 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl
1105 << QuicUtils::StringToHexASCIIDump(packet->AsStringPiece()); 1105 << QuicUtils::StringToHexASCIIDump(packet->AsStringPiece());
1106 1106
1107 DCHECK(encrypted->length() <= kMaxPacketSize) 1107 DCHECK(encrypted->length() <= kMaxPacketSize)
1108 << "Packet " << sequence_number << " will not be read; too large: " 1108 << "Packet " << sequence_number << " will not be read; too large: "
1109 << packet->length() << " " << encrypted->length() << " " 1109 << packet->length() << " " << encrypted->length() << " "
1110 << outgoing_ack_ << " forced: " << (forced == FORCE ? "yes" : "no"); 1110 << outgoing_ack_ << " forced: " << (forced == FORCE ? "yes" : "no");
1111 1111
1112 int error; 1112 int error;
1113 QuicTime now = clock_->Now(); 1113 QuicTime now = clock_->Now();
1114 if (helper_->WritePacketToWire(*encrypted, &error) == -1) { 1114 if (WritePacketToWire(sequence_number, level, *encrypted, &error) == -1) {
1115 if (helper_->IsWriteBlocked(error)) { 1115 if (helper_->IsWriteBlocked(error)) {
1116 // TODO(satyashekhar): It might be more efficient (fewer system calls), if 1116 // TODO(satyashekhar): It might be more efficient (fewer system calls), if
1117 // all connections share this variable i.e this becomes a part of 1117 // all connections share this variable i.e this becomes a part of
1118 // PacketWriterInterface. 1118 // PacketWriterInterface.
1119 write_blocked_ = true; 1119 write_blocked_ = true;
1120 // If the socket buffers the the data, then the packet should not 1120 // If the socket buffers the the data, then the packet should not
1121 // be queued and sent again, which would result in an unnecessary 1121 // be queued and sent again, which would result in an unnecessary
1122 // duplicate packet being sent. 1122 // duplicate packet being sent.
1123 return helper_->IsWriteBlockedDataBuffered(); 1123 return helper_->IsWriteBlockedDataBuffered();
1124 } 1124 }
(...skipping 24 matching lines...) Expand all
1149 1149
1150 if (retransmission == IS_RETRANSMISSION) { 1150 if (retransmission == IS_RETRANSMISSION) {
1151 stats_.bytes_retransmitted += encrypted->length(); 1151 stats_.bytes_retransmitted += encrypted->length();
1152 ++stats_.packets_retransmitted; 1152 ++stats_.packets_retransmitted;
1153 } 1153 }
1154 1154
1155 delete packet; 1155 delete packet;
1156 return true; 1156 return true;
1157 } 1157 }
1158 1158
1159 int QuicConnection::WritePacketToWire(QuicPacketSequenceNumber sequence_number,
1160 EncryptionLevel level,
1161 const QuicEncryptedPacket& packet,
1162 int* error) {
1163 int bytes_written = helper_->WritePacketToWire(packet, error);
1164 if (debug_visitor_) {
1165 // WritePacketToWire returned -1, then |error| will be populated with
1166 // a NetErrorCode, which we want to pass along to the visitor.
1167 debug_visitor_->OnPacketSent(sequence_number, level, packet,
1168 bytes_written == -1 ? *error : bytes_written);
1169 }
1170 return bytes_written;
1171 }
1172
1159 bool QuicConnection::OnSerializedPacket( 1173 bool QuicConnection::OnSerializedPacket(
1160 const SerializedPacket& serialized_packet) { 1174 const SerializedPacket& serialized_packet) {
1161 if (serialized_packet.retransmittable_frames != NULL) { 1175 if (serialized_packet.retransmittable_frames != NULL) {
1162 DCHECK(unacked_packets_.empty() || 1176 DCHECK(unacked_packets_.empty() ||
1163 unacked_packets_.rbegin()->first < 1177 unacked_packets_.rbegin()->first <
1164 serialized_packet.sequence_number); 1178 serialized_packet.sequence_number);
1165 // Retransmitted frames will be sent with the same encryption level as the 1179 // Retransmitted frames will be sent with the same encryption level as the
1166 // original. 1180 // original.
1167 serialized_packet.retransmittable_frames->set_encryption_level( 1181 serialized_packet.retransmittable_frames->set_encryption_level(
1168 encryption_level_); 1182 encryption_level_);
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 if (connection_timeout < timeout) { 1567 if (connection_timeout < timeout) {
1554 timeout = connection_timeout; 1568 timeout = connection_timeout;
1555 } 1569 }
1556 } 1570 }
1557 1571
1558 helper_->SetTimeoutAlarm(timeout); 1572 helper_->SetTimeoutAlarm(timeout);
1559 return false; 1573 return false;
1560 } 1574 }
1561 1575
1562 } // namespace net 1576 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_logger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698