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/socks5_client_socket.h" | 5 #include "net/socket/socks5_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/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } else { | 87 } else { |
88 LoadLog::EndEvent(load_log, LoadLog::TYPE_SOCKS5_CONNECT); | 88 LoadLog::EndEvent(load_log, LoadLog::TYPE_SOCKS5_CONNECT); |
89 load_log_ = NULL; | 89 load_log_ = NULL; |
90 } | 90 } |
91 return rv; | 91 return rv; |
92 } | 92 } |
93 | 93 |
94 void SOCKS5ClientSocket::Disconnect() { | 94 void SOCKS5ClientSocket::Disconnect() { |
95 completed_handshake_ = false; | 95 completed_handshake_ = false; |
96 transport_->Disconnect(); | 96 transport_->Disconnect(); |
| 97 |
| 98 // Reset other states to make sure they aren't mistakenly used later. |
| 99 // These are the states initialized by Connect(). |
| 100 next_state_ = STATE_NONE; |
| 101 user_callback_ = NULL; |
| 102 load_log_ = NULL; |
97 } | 103 } |
98 | 104 |
99 bool SOCKS5ClientSocket::IsConnected() const { | 105 bool SOCKS5ClientSocket::IsConnected() const { |
100 return completed_handshake_ && transport_->IsConnected(); | 106 return completed_handshake_ && transport_->IsConnected(); |
101 } | 107 } |
102 | 108 |
103 bool SOCKS5ClientSocket::IsConnectedAndIdle() const { | 109 bool SOCKS5ClientSocket::IsConnectedAndIdle() const { |
104 return completed_handshake_ && transport_->IsConnectedAndIdle(); | 110 return completed_handshake_ && transport_->IsConnectedAndIdle(); |
105 } | 111 } |
106 | 112 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 444 } |
439 | 445 |
440 #if defined(OS_LINUX) | 446 #if defined(OS_LINUX) |
441 int SOCKS5ClientSocket::GetPeerName(struct sockaddr* name, | 447 int SOCKS5ClientSocket::GetPeerName(struct sockaddr* name, |
442 socklen_t* namelen) { | 448 socklen_t* namelen) { |
443 return transport_->GetPeerName(name, namelen); | 449 return transport_->GetPeerName(name, namelen); |
444 } | 450 } |
445 #endif | 451 #endif |
446 | 452 |
447 } // namespace net | 453 } // namespace net |
OLD | NEW |