OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client_socket_handle.h" | 5 #include "net/socket/client_socket_handle.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/socket/client_socket_pool.h" | 13 #include "net/socket/client_socket_pool.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 ClientSocketHandle::ClientSocketHandle() | 17 ClientSocketHandle::ClientSocketHandle() |
18 : is_initialized_(false), | 18 : is_initialized_(false), |
19 pool_(NULL), | 19 pool_(NULL), |
20 higher_pool_(NULL), | 20 higher_pool_(NULL), |
21 reuse_type_(ClientSocketHandle::UNUSED), | 21 reuse_type_(ClientSocketHandle::UNUSED), |
22 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, | 22 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, |
23 base::Unretained(this))), | 23 base::Unretained(this))), |
24 is_ssl_error_(false) {} | 24 is_ssl_error_(false), |
25 ssl_failure_state_(kSSLFailureNone) { | |
26 } | |
25 | 27 |
26 ClientSocketHandle::~ClientSocketHandle() { | 28 ClientSocketHandle::~ClientSocketHandle() { |
27 Reset(); | 29 Reset(); |
28 } | 30 } |
29 | 31 |
30 void ClientSocketHandle::Reset() { | 32 void ClientSocketHandle::Reset() { |
31 ResetInternal(true); | 33 ResetInternal(true); |
32 ResetErrorState(); | 34 ResetErrorState(); |
33 } | 35 } |
34 | 36 |
(...skipping 30 matching lines...) Expand all Loading... | |
65 idle_time_ = base::TimeDelta(); | 67 idle_time_ = base::TimeDelta(); |
66 init_time_ = base::TimeTicks(); | 68 init_time_ = base::TimeTicks(); |
67 setup_time_ = base::TimeDelta(); | 69 setup_time_ = base::TimeDelta(); |
68 connect_timing_ = LoadTimingInfo::ConnectTiming(); | 70 connect_timing_ = LoadTimingInfo::ConnectTiming(); |
69 pool_id_ = -1; | 71 pool_id_ = -1; |
70 } | 72 } |
71 | 73 |
72 void ClientSocketHandle::ResetErrorState() { | 74 void ClientSocketHandle::ResetErrorState() { |
73 is_ssl_error_ = false; | 75 is_ssl_error_ = false; |
74 ssl_error_response_info_ = HttpResponseInfo(); | 76 ssl_error_response_info_ = HttpResponseInfo(); |
75 pending_http_proxy_connection_.reset(); | 77 pending_http_proxy_connection_.reset(); |
Ryan Sleevi
2015/05/13 22:26:36
BUG?: You forgot to reset the SSLFailureState here
davidben
2015/05/14 23:24:34
Done. (Sigh. Why must we have so many manual "rese
| |
76 } | 78 } |
77 | 79 |
78 LoadState ClientSocketHandle::GetLoadState() const { | 80 LoadState ClientSocketHandle::GetLoadState() const { |
79 CHECK(!is_initialized()); | 81 CHECK(!is_initialized()); |
80 CHECK(!group_name_.empty()); | 82 CHECK(!group_name_.empty()); |
81 // Because of http://crbug.com/37810 we may not have a pool, but have | 83 // Because of http://crbug.com/37810 we may not have a pool, but have |
82 // just a raw socket. | 84 // just a raw socket. |
83 if (!pool_) | 85 if (!pool_) |
84 return LOAD_STATE_IDLE; | 86 return LOAD_STATE_IDLE; |
85 return pool_->GetLoadState(group_name_, this); | 87 return pool_->GetLoadState(group_name_, this); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 // TODO(eroman): This logging is not complete, in particular set_socket() and | 165 // TODO(eroman): This logging is not complete, in particular set_socket() and |
164 // release() socket. It ends up working though, since those methods are being | 166 // release() socket. It ends up working though, since those methods are being |
165 // used to layer sockets (and the destination sources are the same). | 167 // used to layer sockets (and the destination sources are the same). |
166 DCHECK(socket_.get()); | 168 DCHECK(socket_.get()); |
167 socket_->NetLog().BeginEvent( | 169 socket_->NetLog().BeginEvent( |
168 NetLog::TYPE_SOCKET_IN_USE, | 170 NetLog::TYPE_SOCKET_IN_USE, |
169 requesting_source_.ToEventParametersCallback()); | 171 requesting_source_.ToEventParametersCallback()); |
170 } | 172 } |
171 | 173 |
172 } // namespace net | 174 } // namespace net |
OLD | NEW |