| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 int rv = transport_->socket()->Write( | 177 int rv = transport_->socket()->Write( |
| 178 buf, buf_len, | 178 buf, buf_len, |
| 179 base::Bind(&SOCKS5ClientSocket::OnReadWriteComplete, | 179 base::Bind(&SOCKS5ClientSocket::OnReadWriteComplete, |
| 180 base::Unretained(this), callback)); | 180 base::Unretained(this), callback)); |
| 181 if (rv > 0) | 181 if (rv > 0) |
| 182 was_ever_used_ = true; | 182 was_ever_used_ = true; |
| 183 return rv; | 183 return rv; |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) { | 186 int SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) { |
| 187 return transport_->socket()->SetReceiveBufferSize(size); | 187 return transport_->socket()->SetReceiveBufferSize(size); |
| 188 } | 188 } |
| 189 | 189 |
| 190 bool SOCKS5ClientSocket::SetSendBufferSize(int32 size) { | 190 int SOCKS5ClientSocket::SetSendBufferSize(int32 size) { |
| 191 return transport_->socket()->SetSendBufferSize(size); | 191 return transport_->socket()->SetSendBufferSize(size); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void SOCKS5ClientSocket::DoCallback(int result) { | 194 void SOCKS5ClientSocket::DoCallback(int result) { |
| 195 DCHECK_NE(ERR_IO_PENDING, result); | 195 DCHECK_NE(ERR_IO_PENDING, result); |
| 196 DCHECK(!user_callback_.is_null()); | 196 DCHECK(!user_callback_.is_null()); |
| 197 | 197 |
| 198 // Since Run() may result in Read being called, | 198 // Since Run() may result in Read being called, |
| 199 // clear user_callback_ up front. | 199 // clear user_callback_ up front. |
| 200 base::ResetAndReturn(&user_callback_).Run(result); | 200 base::ResetAndReturn(&user_callback_).Run(result); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 497 |
| 498 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { | 498 int SOCKS5ClientSocket::GetPeerAddress(IPEndPoint* address) const { |
| 499 return transport_->socket()->GetPeerAddress(address); | 499 return transport_->socket()->GetPeerAddress(address); |
| 500 } | 500 } |
| 501 | 501 |
| 502 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 502 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| 503 return transport_->socket()->GetLocalAddress(address); | 503 return transport_->socket()->GetLocalAddress(address); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace net | 506 } // namespace net |
| OLD | NEW |