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_ && user_callback_.is_null()); | 238 DCHECK(!old_user_callback_); |
239 | |
240 return transport_->socket()->Write(buf, buf_len, callback); | |
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 | 239 |
248 return transport_->socket()->Write(buf, buf_len, callback); | 240 return transport_->socket()->Write(buf, buf_len, callback); |
249 } | 241 } |
250 | 242 |
251 bool SOCKSClientSocket::SetReceiveBufferSize(int32 size) { | 243 bool SOCKSClientSocket::SetReceiveBufferSize(int32 size) { |
252 return transport_->socket()->SetReceiveBufferSize(size); | 244 return transport_->socket()->SetReceiveBufferSize(size); |
253 } | 245 } |
254 | 246 |
255 bool SOCKSClientSocket::SetSendBufferSize(int32 size) { | 247 bool SOCKSClientSocket::SetSendBufferSize(int32 size) { |
256 return transport_->socket()->SetSendBufferSize(size); | 248 return transport_->socket()->SetSendBufferSize(size); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 469 |
478 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { | 470 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { |
479 return transport_->socket()->GetPeerAddress(address); | 471 return transport_->socket()->GetPeerAddress(address); |
480 } | 472 } |
481 | 473 |
482 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 474 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
483 return transport_->socket()->GetLocalAddress(address); | 475 return transport_->socket()->GetLocalAddress(address); |
484 } | 476 } |
485 | 477 |
486 } // namespace net | 478 } // namespace net |
OLD | NEW |