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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 return base::TimeDelta::FromMicroseconds(-1); | 209 return base::TimeDelta::FromMicroseconds(-1); |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 // Read is called by the transport layer above to read. This can only be done | 213 // Read is called by the transport layer above to read. This can only be done |
214 // if the SOCKS handshake is complete. | 214 // if the SOCKS handshake is complete. |
215 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, | 215 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, |
216 OldCompletionCallback* callback) { | 216 OldCompletionCallback* callback) { |
217 DCHECK(completed_handshake_); | 217 DCHECK(completed_handshake_); |
218 DCHECK_EQ(STATE_NONE, next_state_); | 218 DCHECK_EQ(STATE_NONE, next_state_); |
219 DCHECK(!old_user_callback_); | 219 DCHECK(!old_user_callback_); |
csilv
2011/12/07 00:03:48
change to match line 227
James Hawkins
2011/12/07 00:19:37
Done.
| |
220 | 220 |
221 return transport_->socket()->Read(buf, buf_len, callback); | 221 return transport_->socket()->Read(buf, buf_len, callback); |
222 } | 222 } |
223 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, | |
224 const CompletionCallback& callback) { | |
225 DCHECK(completed_handshake_); | |
226 DCHECK_EQ(STATE_NONE, next_state_); | |
227 DCHECK(!old_user_callback_ && user_callback_.is_null()); | |
228 | |
229 return transport_->socket()->Read(buf, buf_len, callback); | |
230 } | |
223 | 231 |
224 // 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 |
225 // SOCKS handshake is complete. | 233 // SOCKS handshake is complete. |
226 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, | 234 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, |
227 OldCompletionCallback* callback) { | 235 OldCompletionCallback* callback) { |
228 DCHECK(completed_handshake_); | 236 DCHECK(completed_handshake_); |
229 DCHECK_EQ(STATE_NONE, next_state_); | 237 DCHECK_EQ(STATE_NONE, next_state_); |
230 DCHECK(!old_user_callback_); | 238 DCHECK(!old_user_callback_); |
231 | 239 |
232 return transport_->socket()->Write(buf, buf_len, callback); | 240 return transport_->socket()->Write(buf, buf_len, callback); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 | 469 |
462 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { | 470 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { |
463 return transport_->socket()->GetPeerAddress(address); | 471 return transport_->socket()->GetPeerAddress(address); |
464 } | 472 } |
465 | 473 |
466 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 474 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
467 return transport_->socket()->GetLocalAddress(address); | 475 return transport_->socket()->GetLocalAddress(address); |
468 } | 476 } |
469 | 477 |
470 } // namespace net | 478 } // namespace net |
OLD | NEW |