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

Unified Diff: net/quic/quic_connection.cc

Issue 1305293004: Notfiy NQE of QUIC RTT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated with more comments and tests Created 5 years, 3 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 f663111c2cdaf13369d6d438ac02004586c5511f..91b8dcb2a0862e66845713e125d9c3a3289b46ec 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -244,14 +244,16 @@ QuicConnection::QueuedPacket::QueuedPacket(
#define ENDPOINT \
(perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
-QuicConnection::QuicConnection(QuicConnectionId connection_id,
- IPEndPoint address,
- QuicConnectionHelperInterface* helper,
- const PacketWriterFactory& writer_factory,
- bool owns_writer,
- Perspective perspective,
- bool is_secure,
- const QuicVersionVector& supported_versions)
+QuicConnection::QuicConnection(
+ QuicConnectionId connection_id,
+ IPEndPoint address,
+ QuicConnectionHelperInterface* helper,
+ const PacketWriterFactory& writer_factory,
+ bool owns_writer,
+ Perspective perspective,
+ bool is_secure,
+ const QuicVersionVector& supported_versions,
+ scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher)
: framer_(supported_versions,
helper->GetClock()->ApproximateNow(),
perspective),
@@ -320,7 +322,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
next_mtu_probe_at_(kPacketsBetweenMtuProbesBase),
largest_received_packet_size_(0),
goaway_sent_(false),
- goaway_received_(false) {
+ goaway_received_(false),
+ socket_performance_watcher_(socket_performance_watcher.Pass()) {
DVLOG(1) << ENDPOINT << "Created connection with connection_id: "
<< connection_id;
framer_.set_visitor(this);
@@ -1388,6 +1391,14 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address,
MaybeProcessRevivedPacket();
MaybeSendInResponseToPacket();
SetPingAlarm();
+
+ // Notify socket performance watcher of the updated RTT value.
+ if (socket_performance_watcher_) {
+ socket_performance_watcher_->OnUpdatedRTTAvailable(
+ base::TimeDelta::FromMicroseconds(sent_packet_manager_.GetRttStats()
+ ->smoothed_rtt()
+ .ToMicroseconds()));
+ }
}
void QuicConnection::CheckForAddressMigration(
@@ -1730,6 +1741,13 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
return false;
}
+ // Notify socket performance watcher of the updated RTT value.
+ if (socket_performance_watcher_) {
+ socket_performance_watcher_->OnUpdatedRTTAvailable(
+ base::TimeDelta::FromMicroseconds(sent_packet_manager_.GetRttStats()
+ ->smoothed_rtt()
+ .ToMicroseconds()));
+ }
return true;
}

Powered by Google App Engine
This is Rietveld 408576698