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_ && user_callback_.is_null()); | 210 DCHECK(!old_user_callback_); |
211 | |
212 return transport_->socket()->Write(buf, buf_len, callback); | |
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 | 211 |
220 return transport_->socket()->Write(buf, buf_len, callback); | 212 return transport_->socket()->Write(buf, buf_len, callback); |
221 } | 213 } |
222 | 214 |
223 bool SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) { | 215 bool SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) { |
224 return transport_->socket()->SetReceiveBufferSize(size); | 216 return transport_->socket()->SetReceiveBufferSize(size); |
225 } | 217 } |
226 | 218 |
227 bool SOCKS5ClientSocket::SetSendBufferSize(int32 size) { | 219 bool SOCKS5ClientSocket::SetSendBufferSize(int32 size) { |
228 return transport_->socket()->SetSendBufferSize(size); | 220 return transport_->socket()->SetSendBufferSize(size); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 535 |
544 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { | 536 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { |
545 return transport_->socket()->GetPeerAddress(address); | 537 return transport_->socket()->GetPeerAddress(address); |
546 } | 538 } |
547 | 539 |
548 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 540 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
549 return transport_->socket()->GetLocalAddress(address); | 541 return transport_->socket()->GetLocalAddress(address); |
550 } | 542 } |
551 | 543 |
552 } // namespace net | 544 } // namespace net |
OLD | NEW |