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/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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 | 153 |
154 base::TimeDelta SOCKS5ClientSocket::GetConnectTimeMicros() const { | 154 base::TimeDelta SOCKS5ClientSocket::GetConnectTimeMicros() const { |
155 if (transport_.get() && transport_->socket()) { | 155 if (transport_.get() && transport_->socket()) { |
156 return transport_->socket()->GetConnectTimeMicros(); | 156 return transport_->socket()->GetConnectTimeMicros(); |
157 } | 157 } |
158 NOTREACHED(); | 158 NOTREACHED(); |
159 return base::TimeDelta::FromMicroseconds(-1); | 159 return base::TimeDelta::FromMicroseconds(-1); |
160 } | 160 } |
161 | 161 |
| 162 NextProto SOCKS5ClientSocket::GetNegotiatedProtocol() const { |
| 163 if (transport_.get() && transport_->socket()) { |
| 164 return transport_->socket()->GetNegotiatedProtocol(); |
| 165 } |
| 166 NOTREACHED(); |
| 167 return kProtoUnknown; |
| 168 } |
| 169 |
162 // Read is called by the transport layer above to read. This can only be done | 170 // Read is called by the transport layer above to read. This can only be done |
163 // if the SOCKS handshake is complete. | 171 // if the SOCKS handshake is complete. |
164 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, | 172 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, |
165 const CompletionCallback& callback) { | 173 const CompletionCallback& callback) { |
166 DCHECK(completed_handshake_); | 174 DCHECK(completed_handshake_); |
167 DCHECK_EQ(STATE_NONE, next_state_); | 175 DCHECK_EQ(STATE_NONE, next_state_); |
168 DCHECK(user_callback_.is_null()); | 176 DCHECK(user_callback_.is_null()); |
169 | 177 |
170 return transport_->socket()->Read(buf, buf_len, callback); | 178 return transport_->socket()->Read(buf, buf_len, callback); |
171 } | 179 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 506 |
499 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { | 507 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { |
500 return transport_->socket()->GetPeerAddress(address); | 508 return transport_->socket()->GetPeerAddress(address); |
501 } | 509 } |
502 | 510 |
503 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 511 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
504 return transport_->socket()->GetLocalAddress(address); | 512 return transport_->socket()->GetLocalAddress(address); |
505 } | 513 } |
506 | 514 |
507 } // namespace net | 515 } // namespace net |
OLD | NEW |