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

Unified Diff: net/socket/tcp_client_socket_libevent.cc

Issue 7251004: Deciding best connection to schedule requests on based on cwnd and idle time (Reopened after revert) (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Syncing to head Created 9 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 side-by-side diff with in-line comments
Download patch
Index: net/socket/tcp_client_socket_libevent.cc
===================================================================
--- net/socket/tcp_client_socket_libevent.cc (revision 90551)
+++ net/socket/tcp_client_socket_libevent.cc (working copy)
@@ -137,7 +137,8 @@
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
previously_disconnected_(false),
use_tcp_fastopen_(false),
- tcp_fastopen_connected_(false) {
+ tcp_fastopen_connected_(false),
+ num_bytes_read_(0) {
scoped_refptr<NetLog::EventParameters> params;
if (source.is_valid())
params = new NetLogSourceParameter("source_dependency", source);
@@ -298,6 +299,7 @@
// Connect the socket.
if (!use_tcp_fastopen_) {
+ connect_start_time_ = base::TimeTicks::Now();
if (!HANDLE_EINTR(connect(socket_, current_ai_->ai_addr,
static_cast<int>(current_ai_->ai_addrlen)))) {
// Connected without waiting!
@@ -337,6 +339,7 @@
net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT_ATTEMPT, params);
if (result == OK) {
+ connect_time_micros_ = base::TimeTicks::Now() - connect_start_time_;
write_socket_watcher_.StopWatchingFileDescriptor();
use_history_.set_was_ever_connected();
return OK; // Done!
@@ -439,6 +442,7 @@
if (nread >= 0) {
base::StatsCounter read_bytes("tcp.read_bytes");
read_bytes.Add(nread);
+ num_bytes_read_ += static_cast<int64>(nread);
if (nread > 0)
use_history_.set_was_used_to_convey_data();
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, nread,
@@ -633,6 +637,7 @@
result = bytes_transferred;
base::StatsCounter read_bytes("tcp.read_bytes");
read_bytes.Add(bytes_transferred);
+ num_bytes_read_ += static_cast<int64>(bytes_transferred);
if (bytes_transferred > 0)
use_history_.set_was_used_to_convey_data();
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, result,
@@ -722,4 +727,12 @@
return use_tcp_fastopen_;
}
+int64 TCPClientSocketLibevent::NumBytesRead() const {
+ return num_bytes_read_;
+}
+
+base::TimeDelta TCPClientSocketLibevent::GetConnectTimeMicros() const {
+ return connect_time_micros_;
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698