| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 : transport_(transport_socket), | 61 : transport_(transport_socket), |
| 62 next_state_(STATE_NONE), | 62 next_state_(STATE_NONE), |
| 63 completed_handshake_(false), | 63 completed_handshake_(false), |
| 64 bytes_sent_(0), | 64 bytes_sent_(0), |
| 65 bytes_received_(0), | 65 bytes_received_(0), |
| 66 host_resolver_(host_resolver), | 66 host_resolver_(host_resolver), |
| 67 host_request_info_(req_info), | 67 host_request_info_(req_info), |
| 68 net_log_(transport_socket->socket()->NetLog()) { | 68 net_log_(transport_socket->socket()->NetLog()) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 SOCKSClientSocket::SOCKSClientSocket(StreamSocket* transport_socket, | |
| 72 const HostResolver::RequestInfo& req_info, | |
| 73 HostResolver* host_resolver) | |
| 74 : transport_(new ClientSocketHandle()), | |
| 75 next_state_(STATE_NONE), | |
| 76 completed_handshake_(false), | |
| 77 bytes_sent_(0), | |
| 78 bytes_received_(0), | |
| 79 host_resolver_(host_resolver), | |
| 80 host_request_info_(req_info), | |
| 81 net_log_(transport_socket->NetLog()) { | |
| 82 transport_->set_socket(transport_socket); | |
| 83 } | |
| 84 | |
| 85 SOCKSClientSocket::~SOCKSClientSocket() { | 71 SOCKSClientSocket::~SOCKSClientSocket() { |
| 86 Disconnect(); | 72 Disconnect(); |
| 87 } | 73 } |
| 88 | 74 |
| 89 int SOCKSClientSocket::Connect(const CompletionCallback& callback) { | 75 int SOCKSClientSocket::Connect(const CompletionCallback& callback) { |
| 90 DCHECK(transport_.get()); | 76 DCHECK(transport_.get()); |
| 91 DCHECK(transport_->socket()); | 77 DCHECK(transport_->socket()); |
| 92 DCHECK_EQ(STATE_NONE, next_state_); | 78 DCHECK_EQ(STATE_NONE, next_state_); |
| 93 DCHECK(user_callback_.is_null()); | 79 DCHECK(user_callback_.is_null()); |
| 94 | 80 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 422 |
| 437 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { | 423 int SOCKSClientSocket::GetPeerAddress(IPEndPoint* address) const { |
| 438 return transport_->socket()->GetPeerAddress(address); | 424 return transport_->socket()->GetPeerAddress(address); |
| 439 } | 425 } |
| 440 | 426 |
| 441 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 427 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| 442 return transport_->socket()->GetLocalAddress(address); | 428 return transport_->socket()->GetLocalAddress(address); |
| 443 } | 429 } |
| 444 | 430 |
| 445 } // namespace net | 431 } // namespace net |
| OLD | NEW |