OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/trace_event.h" | 9 #include "base/trace_event.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 user_callback_ = callback; | 100 user_callback_ = callback; |
101 } else { | 101 } else { |
102 LoadLog::EndEvent(load_log, LoadLog::TYPE_SOCKS_CONNECT); | 102 LoadLog::EndEvent(load_log, LoadLog::TYPE_SOCKS_CONNECT); |
103 load_log_ = NULL; | 103 load_log_ = NULL; |
104 } | 104 } |
105 return rv; | 105 return rv; |
106 } | 106 } |
107 | 107 |
108 void SOCKSClientSocket::Disconnect() { | 108 void SOCKSClientSocket::Disconnect() { |
109 completed_handshake_ = false; | 109 completed_handshake_ = false; |
| 110 host_resolver_.Cancel(); |
110 transport_->Disconnect(); | 111 transport_->Disconnect(); |
| 112 |
| 113 // Reset other states to make sure they aren't mistakenly used later. |
| 114 // These are the states initialized by Connect(). |
| 115 next_state_ = STATE_NONE; |
| 116 user_callback_ = NULL; |
| 117 load_log_ = NULL; |
111 } | 118 } |
112 | 119 |
113 bool SOCKSClientSocket::IsConnected() const { | 120 bool SOCKSClientSocket::IsConnected() const { |
114 return completed_handshake_ && transport_->IsConnected(); | 121 return completed_handshake_ && transport_->IsConnected(); |
115 } | 122 } |
116 | 123 |
117 bool SOCKSClientSocket::IsConnectedAndIdle() const { | 124 bool SOCKSClientSocket::IsConnectedAndIdle() const { |
118 return completed_handshake_ && transport_->IsConnectedAndIdle(); | 125 return completed_handshake_ && transport_->IsConnectedAndIdle(); |
119 } | 126 } |
120 | 127 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 398 } |
392 | 399 |
393 #if defined(OS_LINUX) | 400 #if defined(OS_LINUX) |
394 int SOCKSClientSocket::GetPeerName(struct sockaddr* name, | 401 int SOCKSClientSocket::GetPeerName(struct sockaddr* name, |
395 socklen_t* namelen) { | 402 socklen_t* namelen) { |
396 return transport_->GetPeerName(name, namelen); | 403 return transport_->GetPeerName(name, namelen); |
397 } | 404 } |
398 #endif | 405 #endif |
399 | 406 |
400 } // namespace net | 407 } // namespace net |
OLD | NEW |