OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 bool SOCKS5ClientSocket::UsingTCPFastOpen() const { | 137 bool SOCKS5ClientSocket::UsingTCPFastOpen() const { |
138 if (transport_.get() && transport_->socket()) { | 138 if (transport_.get() && transport_->socket()) { |
139 return transport_->socket()->UsingTCPFastOpen(); | 139 return transport_->socket()->UsingTCPFastOpen(); |
140 } | 140 } |
141 NOTREACHED(); | 141 NOTREACHED(); |
142 return false; | 142 return false; |
143 } | 143 } |
144 | 144 |
| 145 int64 SOCKS5ClientSocket::NumBytesRead() const { |
| 146 if (transport_.get() && transport_->socket()) { |
| 147 return transport_->socket()->NumBytesRead(); |
| 148 } |
| 149 NOTREACHED(); |
| 150 return -1; |
| 151 } |
| 152 |
| 153 int SOCKS5ClientSocket::GetConnectTimeMicros() const { |
| 154 if (transport_.get() && transport_->socket()) { |
| 155 return transport_->socket()->GetConnectTimeMicros(); |
| 156 } |
| 157 NOTREACHED(); |
| 158 return -1; |
| 159 } |
| 160 |
145 // Read is called by the transport layer above to read. This can only be done | 161 // Read is called by the transport layer above to read. This can only be done |
146 // if the SOCKS handshake is complete. | 162 // if the SOCKS handshake is complete. |
147 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, | 163 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, |
148 CompletionCallback* callback) { | 164 CompletionCallback* callback) { |
149 DCHECK(completed_handshake_); | 165 DCHECK(completed_handshake_); |
150 DCHECK_EQ(STATE_NONE, next_state_); | 166 DCHECK_EQ(STATE_NONE, next_state_); |
151 DCHECK(!user_callback_); | 167 DCHECK(!user_callback_); |
152 | 168 |
153 return transport_->socket()->Read(buf, buf_len, callback); | 169 return transport_->socket()->Read(buf, buf_len, callback); |
154 } | 170 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 497 |
482 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { | 498 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { |
483 return transport_->socket()->GetPeerAddress(address); | 499 return transport_->socket()->GetPeerAddress(address); |
484 } | 500 } |
485 | 501 |
486 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 502 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
487 return transport_->socket()->GetLocalAddress(address); | 503 return transport_->socket()->GetLocalAddress(address); |
488 } | 504 } |
489 | 505 |
490 } // namespace net | 506 } // namespace net |
OLD | NEW |