OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/socket/tcp_client_socket_pool.h" | 5 #include "net/socket/tcp_client_socket_pool.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (result == OK) { | 107 if (result == OK) { |
108 DCHECK(connect_start_time_ != base::TimeTicks()); | 108 DCHECK(connect_start_time_ != base::TimeTicks()); |
109 base::TimeDelta connect_duration = | 109 base::TimeDelta connect_duration = |
110 base::TimeTicks::Now() - connect_start_time_; | 110 base::TimeTicks::Now() - connect_start_time_; |
111 | 111 |
112 UMA_HISTOGRAM_CLIPPED_TIMES("Net.TCP_Connection_Latency", | 112 UMA_HISTOGRAM_CLIPPED_TIMES("Net.TCP_Connection_Latency", |
113 connect_duration, | 113 connect_duration, |
114 base::TimeDelta::FromMilliseconds(1), | 114 base::TimeDelta::FromMilliseconds(1), |
115 base::TimeDelta::FromMinutes(10), | 115 base::TimeDelta::FromMinutes(10), |
116 100); | 116 100); |
| 117 } else { |
| 118 // Delete the socket on error. |
| 119 set_socket(NULL); |
117 } | 120 } |
118 | 121 |
119 return result; | 122 return result; |
120 } | 123 } |
121 | 124 |
122 ConnectJob* TCPClientSocketPool::TCPConnectJobFactory::NewConnectJob( | 125 ConnectJob* TCPClientSocketPool::TCPConnectJobFactory::NewConnectJob( |
123 const std::string& group_name, | 126 const std::string& group_name, |
124 const ClientSocketPoolBase::Request& request, | 127 const ClientSocketPoolBase::Request& request, |
125 ConnectJob::Delegate* delegate) const { | 128 ConnectJob::Delegate* delegate) const { |
126 return new TCPConnectJob( | 129 return new TCPConnectJob( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 const std::string& group_name) const { | 171 const std::string& group_name) const { |
169 return base_->IdleSocketCountInGroup(group_name); | 172 return base_->IdleSocketCountInGroup(group_name); |
170 } | 173 } |
171 | 174 |
172 LoadState TCPClientSocketPool::GetLoadState( | 175 LoadState TCPClientSocketPool::GetLoadState( |
173 const std::string& group_name, const ClientSocketHandle* handle) const { | 176 const std::string& group_name, const ClientSocketHandle* handle) const { |
174 return base_->GetLoadState(group_name, handle); | 177 return base_->GetLoadState(group_name, handle); |
175 } | 178 } |
176 | 179 |
177 } // namespace net | 180 } // namespace net |
OLD | NEW |