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

Side by Side Diff: net/socket/tcp_client_socket_pool.cc

Issue 150205: Make ConnectJob::ReleaseSocket() return NULL on connection error. (Closed)
Patch Set: Created 11 years, 5 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« net/socket/client_socket_pool_base.cc ('K') | « net/socket/client_socket_pool_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698