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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 DCHECK(completed_handshake_); | 197 DCHECK(completed_handshake_); |
198 DCHECK_EQ(STATE_NONE, next_state_); | 198 DCHECK_EQ(STATE_NONE, next_state_); |
199 DCHECK(!old_user_callback_ && user_callback_.is_null()); | 199 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
200 | 200 |
201 return transport_->socket()->Read(buf, buf_len, callback); | 201 return transport_->socket()->Read(buf, buf_len, callback); |
202 } | 202 } |
203 | 203 |
204 // 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 |
205 // SOCKS handshake is complete. | 205 // SOCKS handshake is complete. |
206 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, | 206 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, |
207 OldCompletionCallback* callback) { | 207 OldCompletionCallback* callback) { |
208 DCHECK(completed_handshake_); | 208 DCHECK(completed_handshake_); |
209 DCHECK_EQ(STATE_NONE, next_state_); | 209 DCHECK_EQ(STATE_NONE, next_state_); |
210 DCHECK(!old_user_callback_); | 210 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
211 | 211 |
212 return transport_->socket()->Write(buf, buf_len, callback); | 212 return transport_->socket()->Write(buf, buf_len, callback); |
213 } | 213 } |
| 214 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, |
| 215 const CompletionCallback& callback) { |
| 216 DCHECK(completed_handshake_); |
| 217 DCHECK_EQ(STATE_NONE, next_state_); |
| 218 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
| 219 |
| 220 return transport_->socket()->Write(buf, buf_len, callback); |
| 221 } |
214 | 222 |
215 bool SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) { | 223 bool SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) { |
216 return transport_->socket()->SetReceiveBufferSize(size); | 224 return transport_->socket()->SetReceiveBufferSize(size); |
217 } | 225 } |
218 | 226 |
219 bool SOCKS5ClientSocket::SetSendBufferSize(int32 size) { | 227 bool SOCKS5ClientSocket::SetSendBufferSize(int32 size) { |
220 return transport_->socket()->SetSendBufferSize(size); | 228 return transport_->socket()->SetSendBufferSize(size); |
221 } | 229 } |
222 | 230 |
223 void SOCKS5ClientSocket::DoCallback(int result) { | 231 void SOCKS5ClientSocket::DoCallback(int result) { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 543 |
536 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { | 544 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { |
537 return transport_->socket()->GetPeerAddress(address); | 545 return transport_->socket()->GetPeerAddress(address); |
538 } | 546 } |
539 | 547 |
540 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 548 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
541 return transport_->socket()->GetLocalAddress(address); | 549 return transport_->socket()->GetLocalAddress(address); |
542 } | 550 } |
543 | 551 |
544 } // namespace net | 552 } // namespace net |
OLD | NEW |