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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 bool SOCKSClientSocket::UsingTCPFastOpen() const { | 164 bool SOCKSClientSocket::UsingTCPFastOpen() const { |
165 if (transport_.get() && transport_->socket()) { | 165 if (transport_.get() && transport_->socket()) { |
166 return transport_->socket()->UsingTCPFastOpen(); | 166 return transport_->socket()->UsingTCPFastOpen(); |
167 } | 167 } |
168 NOTREACHED(); | 168 NOTREACHED(); |
169 return false; | 169 return false; |
170 } | 170 } |
171 | 171 |
172 int64 SOCKSClientSocket::NumBytesRead() const { | |
173 if (transport_.get() && transport_->socket()) { | |
174 return transport_->socket()->NumBytesRead(); | |
175 } | |
176 NOTREACHED(); | |
177 return -1; | |
178 } | |
179 | |
180 base::TimeDelta SOCKSClientSocket::GetConnectTimeMicros() const { | |
181 if (transport_.get() && transport_->socket()) { | |
182 return transport_->socket()->GetConnectTimeMicros(); | |
183 } | |
184 NOTREACHED(); | |
185 return base::TimeDelta::FromMicroseconds(-1); | |
186 } | |
187 | |
188 | 172 |
189 // Read is called by the transport layer above to read. This can only be done | 173 // Read is called by the transport layer above to read. This can only be done |
190 // if the SOCKS handshake is complete. | 174 // if the SOCKS handshake is complete. |
191 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, | 175 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, |
192 CompletionCallback* callback) { | 176 CompletionCallback* callback) { |
193 DCHECK(completed_handshake_); | 177 DCHECK(completed_handshake_); |
194 DCHECK_EQ(STATE_NONE, next_state_); | 178 DCHECK_EQ(STATE_NONE, next_state_); |
195 DCHECK(!user_callback_); | 179 DCHECK(!user_callback_); |
196 | 180 |
197 return transport_->socket()->Read(buf, buf_len, callback); | 181 return transport_->socket()->Read(buf, buf_len, callback); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 412 |
429 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { | 413 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { |
430 return transport_->socket()->GetPeerAddress(address); | 414 return transport_->socket()->GetPeerAddress(address); |
431 } | 415 } |
432 | 416 |
433 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { | 417 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { |
434 return transport_->socket()->GetLocalAddress(address); | 418 return transport_->socket()->GetLocalAddress(address); |
435 } | 419 } |
436 | 420 |
437 } // namespace net | 421 } // namespace net |
OLD | NEW |