OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 NOTREACHED(); | 181 NOTREACHED(); |
182 return base::TimeDelta::FromMicroseconds(-1); | 182 return base::TimeDelta::FromMicroseconds(-1); |
183 } | 183 } |
184 | 184 |
185 // Read is called by the transport layer above to read. This can only be done | 185 // Read is called by the transport layer above to read. This can only be done |
186 // if the SOCKS handshake is complete. | 186 // if the SOCKS handshake is complete. |
187 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, | 187 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, |
188 OldCompletionCallback* callback) { | 188 OldCompletionCallback* callback) { |
189 DCHECK(completed_handshake_); | 189 DCHECK(completed_handshake_); |
190 DCHECK_EQ(STATE_NONE, next_state_); | 190 DCHECK_EQ(STATE_NONE, next_state_); |
191 DCHECK(!old_user_callback_); | 191 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
192 | 192 |
193 return transport_->socket()->Read(buf, buf_len, callback); | 193 return transport_->socket()->Read(buf, buf_len, callback); |
194 } | 194 } |
| 195 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, |
| 196 const CompletionCallback& callback) { |
| 197 DCHECK(completed_handshake_); |
| 198 DCHECK_EQ(STATE_NONE, next_state_); |
| 199 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
| 200 |
| 201 return transport_->socket()->Read(buf, buf_len, callback); |
| 202 } |
195 | 203 |
196 // Write is called by the transport layer. This can only be done if the | 204 // Write is called by the transport layer. This can only be done if the |
197 // SOCKS handshake is complete. | 205 // SOCKS handshake is complete. |
198 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, | 206 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, |
199 OldCompletionCallback* callback) { | 207 OldCompletionCallback* callback) { |
200 DCHECK(completed_handshake_); | 208 DCHECK(completed_handshake_); |
201 DCHECK_EQ(STATE_NONE, next_state_); | 209 DCHECK_EQ(STATE_NONE, next_state_); |
202 DCHECK(!old_user_callback_); | 210 DCHECK(!old_user_callback_); |
203 | 211 |
204 return transport_->socket()->Write(buf, buf_len, callback); | 212 return transport_->socket()->Write(buf, buf_len, callback); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 535 |
528 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { | 536 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { |
529 return transport_->socket()->GetPeerAddress(address); | 537 return transport_->socket()->GetPeerAddress(address); |
530 } | 538 } |
531 | 539 |
532 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 540 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
533 return transport_->socket()->GetLocalAddress(address); | 541 return transport_->socket()->GetLocalAddress(address); |
534 } | 542 } |
535 | 543 |
536 } // namespace net | 544 } // namespace net |
OLD | NEW |