OLD | NEW |
1 // Copyright (c) 2011 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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
(...skipping 123 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 base::TimeDelta SOCKS5ClientSocket::GetConnectTimeMicros() const { | |
154 if (transport_.get() && transport_->socket()) { | |
155 return transport_->socket()->GetConnectTimeMicros(); | |
156 } | |
157 NOTREACHED(); | |
158 return base::TimeDelta::FromMicroseconds(-1); | |
159 } | |
160 | |
161 // Read is called by the transport layer above to read. This can only be done | 145 // Read is called by the transport layer above to read. This can only be done |
162 // if the SOCKS handshake is complete. | 146 // if the SOCKS handshake is complete. |
163 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, | 147 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, |
164 CompletionCallback* callback) { | 148 CompletionCallback* callback) { |
165 DCHECK(completed_handshake_); | 149 DCHECK(completed_handshake_); |
166 DCHECK_EQ(STATE_NONE, next_state_); | 150 DCHECK_EQ(STATE_NONE, next_state_); |
167 DCHECK(!user_callback_); | 151 DCHECK(!user_callback_); |
168 | 152 |
169 return transport_->socket()->Read(buf, buf_len, callback); | 153 return transport_->socket()->Read(buf, buf_len, callback); |
170 } | 154 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 481 |
498 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { | 482 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { |
499 return transport_->socket()->GetPeerAddress(address); | 483 return transport_->socket()->GetPeerAddress(address); |
500 } | 484 } |
501 | 485 |
502 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { | 486 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { |
503 return transport_->socket()->GetLocalAddress(address); | 487 return transport_->socket()->GetLocalAddress(address); |
504 } | 488 } |
505 | 489 |
506 } // namespace net | 490 } // namespace net |
OLD | NEW |