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/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/bind.h" | 8 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 | 175 |
176 base::TimeDelta SOCKSClientSocket::GetConnectTimeMicros() const { | 176 base::TimeDelta SOCKSClientSocket::GetConnectTimeMicros() const { |
177 if (transport_.get() && transport_->socket()) { | 177 if (transport_.get() && transport_->socket()) { |
178 return transport_->socket()->GetConnectTimeMicros(); | 178 return transport_->socket()->GetConnectTimeMicros(); |
179 } | 179 } |
180 NOTREACHED(); | 180 NOTREACHED(); |
181 return base::TimeDelta::FromMicroseconds(-1); | 181 return base::TimeDelta::FromMicroseconds(-1); |
182 } | 182 } |
183 | 183 |
| 184 NextProto SOCKSClientSocket::GetNegotiatedProtocol() const { |
| 185 if (transport_.get() && transport_->socket()) { |
| 186 return transport_->socket()->GetNegotiatedProtocol(); |
| 187 } |
| 188 NOTREACHED(); |
| 189 return kProtoUnknown; |
| 190 } |
| 191 |
184 // Read is called by the transport layer above to read. This can only be done | 192 // Read is called by the transport layer above to read. This can only be done |
185 // if the SOCKS handshake is complete. | 193 // if the SOCKS handshake is complete. |
186 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, | 194 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, |
187 const CompletionCallback& callback) { | 195 const CompletionCallback& callback) { |
188 DCHECK(completed_handshake_); | 196 DCHECK(completed_handshake_); |
189 DCHECK_EQ(STATE_NONE, next_state_); | 197 DCHECK_EQ(STATE_NONE, next_state_); |
190 DCHECK(user_callback_.is_null()); | 198 DCHECK(user_callback_.is_null()); |
191 | 199 |
192 return transport_->socket()->Read(buf, buf_len, callback); | 200 return transport_->socket()->Read(buf, buf_len, callback); |
193 } | 201 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 435 |
428 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { | 436 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { |
429 return transport_->socket()->GetPeerAddress(address); | 437 return transport_->socket()->GetPeerAddress(address); |
430 } | 438 } |
431 | 439 |
432 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 440 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
433 return transport_->socket()->GetLocalAddress(address); | 441 return transport_->socket()->GetLocalAddress(address); |
434 } | 442 } |
435 | 443 |
436 } // namespace net | 444 } // namespace net |
OLD | NEW |