Chromium Code Reviews| Index: net/socket/tcp_client_socket_libevent.cc |
| =================================================================== |
| --- net/socket/tcp_client_socket_libevent.cc (revision 88789) |
| +++ net/socket/tcp_client_socket_libevent.cc (working copy) |
| @@ -142,7 +142,9 @@ |
| 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), |
| + connect_time_micros_(-1) { |
| scoped_refptr<NetLog::EventParameters> params; |
| if (source.is_valid()) |
| params = new NetLogSourceParameter("source_dependency", source); |
| @@ -303,6 +305,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 +347,8 @@ |
| write_socket_watcher_.StopWatchingFileDescriptor(); |
| if (result == OK) { |
| + connect_time_micros_ = (base::Time::Now() - |
| + connect_start_time_).InMicroseconds(); |
| use_history_.set_was_ever_connected(); |
| return OK; // Done! |
| } |
| @@ -430,9 +435,12 @@ |
| DCHECK_GT(buf_len, 0); |
| int nread = HANDLE_EINTR(read(socket_, buf->data(), buf_len)); |
| + LOG(ERROR) << "this = " << (int*) this << "\tnread = " << nread; |
|
willchan no longer on Chromium
2011/06/13 15:06:07
Ditch these LOGs please.
Gagan
2011/06/14 18:25:02
Done.
|
| 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 +459,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 +636,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, |