Chromium Code Reviews| Index: net/socket/tcp_client_socket_libevent.cc |
| =================================================================== |
| --- net/socket/tcp_client_socket_libevent.cc (revision 88319) |
| +++ net/socket/tcp_client_socket_libevent.cc (working copy) |
| @@ -142,7 +142,10 @@ |
| net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)), |
| previously_disconnected_(false), |
| use_tcp_fastopen_(false), |
| - tcp_fastopen_connected_(false) { |
| + tcp_fastopen_connected_(false), |
| + connect_start_time_(), |
|
willchan no longer on Chromium
2011/06/09 15:08:54
No need to explicitly invoke the empty constructor
Gagan
2011/06/09 19:49:26
Done.
|
| + num_bytes_read_(0), |
| + rtt_ms_(0) { |
| scoped_refptr<NetLog::EventParameters> params; |
| if (source.is_valid()) |
| params = new NetLogSourceParameter("source_dependency", source); |
| @@ -303,6 +306,7 @@ |
| // Connect the socket. |
| if (!use_tcp_fastopen_) { |
| + connect_start_time_ = base::Time::Now(); |
| if (!HANDLE_EINTR(connect(socket_, current_ai_->ai_addr, |
| static_cast<int>(current_ai_->ai_addrlen)))) { |
| // Connected without waiting! |
| @@ -344,6 +348,9 @@ |
| write_socket_watcher_.StopWatchingFileDescriptor(); |
| if (result == OK) { |
| + rtt_ms_ = static_cast<double>((base::Time::Now() - |
|
willchan no longer on Chromium
2011/06/09 15:08:54
Why is this kept as a double? Seems better to use
Gagan
2011/06/09 19:49:26
Initially i chose double because i didn't want to
|
| + connect_start_time_).InMicroseconds()) |
| + / 1000.0; |
| use_history_.set_was_ever_connected(); |
| return OK; // Done! |
| } |
| @@ -430,9 +437,12 @@ |
| DCHECK_GT(buf_len, 0); |
| int nread = HANDLE_EINTR(read(socket_, buf->data(), buf_len)); |
| + LOG(ERROR) << "this = " << (int*) this << "\tnread = " << nread; |
|
Mike Belshe
2011/06/09 16:08:52
nit: please remove the debugging lines.
Gagan
2011/06/09 19:49:26
Will remove in the last round.
For now, please acc
Gagan
2011/06/14 18:25:02
Removed.
|
| if (nread >= 0) { |
| base::StatsCounter read_bytes("tcp.read_bytes"); |
| read_bytes.Add(nread); |
| + num_bytes_read_ += static_cast<int64>(nread); |
| + LOG(ERROR) << "this = " << (int*) this << "\tRead " << nread; |
| if (nread > 0) |
| use_history_.set_was_used_to_convey_data(); |
| net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, nread, |
| @@ -451,6 +461,7 @@ |
| return MapSystemError(errno); |
| } |
| + LOG(ERROR) << "this = " << (int*) this << "\tread_buf_len_ = " << read_buf_len_; |
| read_buf_ = buf; |
| read_buf_len_ = buf_len; |
| read_callback_ = callback; |
| @@ -627,6 +638,8 @@ |
| result = bytes_transferred; |
| base::StatsCounter read_bytes("tcp.read_bytes"); |
| read_bytes.Add(bytes_transferred); |
| + num_bytes_read_ += static_cast<int64>(bytes_transferred); |
| + LOG(ERROR) << "this = " << (int*) this << "\tRead " << bytes_transferred; |
| if (bytes_transferred > 0) |
| use_history_.set_was_used_to_convey_data(); |
| net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, result, |