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/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 "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 return transport_->socket()->Read(buf, buf_len, callback); | 229 return transport_->socket()->Read(buf, buf_len, callback); |
230 } | 230 } |
231 | 231 |
232 // Write is called by the transport layer. This can only be done if the | 232 // Write is called by the transport layer. This can only be done if the |
233 // SOCKS handshake is complete. | 233 // SOCKS handshake is complete. |
234 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, | 234 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, |
235 OldCompletionCallback* callback) { | 235 OldCompletionCallback* callback) { |
236 DCHECK(completed_handshake_); | 236 DCHECK(completed_handshake_); |
237 DCHECK_EQ(STATE_NONE, next_state_); | 237 DCHECK_EQ(STATE_NONE, next_state_); |
238 DCHECK(!old_user_callback_); | 238 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
239 | 239 |
240 return transport_->socket()->Write(buf, buf_len, callback); | 240 return transport_->socket()->Write(buf, buf_len, callback); |
241 } | 241 } |
| 242 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, |
| 243 const CompletionCallback& callback) { |
| 244 DCHECK(completed_handshake_); |
| 245 DCHECK_EQ(STATE_NONE, next_state_); |
| 246 DCHECK(!old_user_callback_ && user_callback_.is_null()); |
| 247 |
| 248 return transport_->socket()->Write(buf, buf_len, callback); |
| 249 } |
242 | 250 |
243 bool SOCKSClientSocket::SetReceiveBufferSize(int32 size) { | 251 bool SOCKSClientSocket::SetReceiveBufferSize(int32 size) { |
244 return transport_->socket()->SetReceiveBufferSize(size); | 252 return transport_->socket()->SetReceiveBufferSize(size); |
245 } | 253 } |
246 | 254 |
247 bool SOCKSClientSocket::SetSendBufferSize(int32 size) { | 255 bool SOCKSClientSocket::SetSendBufferSize(int32 size) { |
248 return transport_->socket()->SetSendBufferSize(size); | 256 return transport_->socket()->SetSendBufferSize(size); |
249 } | 257 } |
250 | 258 |
251 void SOCKSClientSocket::DoCallback(int result) { | 259 void SOCKSClientSocket::DoCallback(int result) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 477 |
470 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { | 478 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { |
471 return transport_->socket()->GetPeerAddress(address); | 479 return transport_->socket()->GetPeerAddress(address); |
472 } | 480 } |
473 | 481 |
474 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 482 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
475 return transport_->socket()->GetLocalAddress(address); | 483 return transport_->socket()->GetLocalAddress(address); |
476 } | 484 } |
477 | 485 |
478 } // namespace net | 486 } // namespace net |
OLD | NEW |