| 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 24 matching lines...) Expand all Loading... |
| 35 transport_(transport_socket), | 35 transport_(transport_socket), |
| 36 next_state_(STATE_NONE), | 36 next_state_(STATE_NONE), |
| 37 completed_handshake_(false), | 37 completed_handshake_(false), |
| 38 bytes_sent_(0), | 38 bytes_sent_(0), |
| 39 bytes_received_(0), | 39 bytes_received_(0), |
| 40 read_header_size(kReadHeaderSize), | 40 read_header_size(kReadHeaderSize), |
| 41 host_request_info_(req_info), | 41 host_request_info_(req_info), |
| 42 net_log_(transport_socket->socket()->NetLog()) { | 42 net_log_(transport_socket->socket()->NetLog()) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 SOCKS5ClientSocket::SOCKS5ClientSocket( | |
| 46 StreamSocket* transport_socket, | |
| 47 const HostResolver::RequestInfo& req_info) | |
| 48 : io_callback_(base::Bind(&SOCKS5ClientSocket::OnIOComplete, | |
| 49 base::Unretained(this))), | |
| 50 transport_(new ClientSocketHandle()), | |
| 51 next_state_(STATE_NONE), | |
| 52 completed_handshake_(false), | |
| 53 bytes_sent_(0), | |
| 54 bytes_received_(0), | |
| 55 read_header_size(kReadHeaderSize), | |
| 56 host_request_info_(req_info), | |
| 57 net_log_(transport_socket->NetLog()) { | |
| 58 transport_->set_socket(transport_socket); | |
| 59 } | |
| 60 | |
| 61 SOCKS5ClientSocket::~SOCKS5ClientSocket() { | 45 SOCKS5ClientSocket::~SOCKS5ClientSocket() { |
| 62 Disconnect(); | 46 Disconnect(); |
| 63 } | 47 } |
| 64 | 48 |
| 65 int SOCKS5ClientSocket::Connect(const CompletionCallback& callback) { | 49 int SOCKS5ClientSocket::Connect(const CompletionCallback& callback) { |
| 66 DCHECK(transport_.get()); | 50 DCHECK(transport_.get()); |
| 67 DCHECK(transport_->socket()); | 51 DCHECK(transport_->socket()); |
| 68 DCHECK_EQ(STATE_NONE, next_state_); | 52 DCHECK_EQ(STATE_NONE, next_state_); |
| 69 DCHECK(user_callback_.is_null()); | 53 DCHECK(user_callback_.is_null()); |
| 70 | 54 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 478 |
| 495 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { | 479 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { |
| 496 return transport_->socket()->GetPeerAddress(address); | 480 return transport_->socket()->GetPeerAddress(address); |
| 497 } | 481 } |
| 498 | 482 |
| 499 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 483 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| 500 return transport_->socket()->GetLocalAddress(address); | 484 return transport_->socket()->GetLocalAddress(address); |
| 501 } | 485 } |
| 502 | 486 |
| 503 } // namespace net | 487 } // namespace net |
| OLD | NEW |