| 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/transport_client_socket_pool.h" | 5 #include "net/socket/transport_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 virtual void Disconnect() { | 60 virtual void Disconnect() { |
| 61 connected_ = false; | 61 connected_ = false; |
| 62 } | 62 } |
| 63 virtual bool IsConnected() const { | 63 virtual bool IsConnected() const { |
| 64 return connected_; | 64 return connected_; |
| 65 } | 65 } |
| 66 virtual bool IsConnectedAndIdle() const { | 66 virtual bool IsConnectedAndIdle() const { |
| 67 return connected_; | 67 return connected_; |
| 68 } | 68 } |
| 69 virtual int GetPeerAddress(AddressList* address) const { | 69 virtual int GetPeerAddress(IPEndPoint* address) const { |
| 70 return ERR_UNEXPECTED; | 70 return ERR_UNEXPECTED; |
| 71 } | 71 } |
| 72 virtual int GetLocalAddress(IPEndPoint* address) const { | 72 virtual int GetLocalAddress(IPEndPoint* address) const { |
| 73 if (!connected_) | 73 if (!connected_) |
| 74 return ERR_SOCKET_NOT_CONNECTED; | 74 return ERR_SOCKET_NOT_CONNECTED; |
| 75 if (addrlist_.front().GetFamily() == AF_INET) | 75 if (addrlist_.front().GetFamily() == AF_INET) |
| 76 SetIPv4Address(address); | 76 SetIPv4Address(address); |
| 77 else | 77 else |
| 78 SetIPv6Address(address); | 78 SetIPv6Address(address); |
| 79 return OK; | 79 return OK; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 virtual void Disconnect() {} | 124 virtual void Disconnect() {} |
| 125 | 125 |
| 126 virtual bool IsConnected() const { | 126 virtual bool IsConnected() const { |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 virtual bool IsConnectedAndIdle() const { | 129 virtual bool IsConnectedAndIdle() const { |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 virtual int GetPeerAddress(AddressList* address) const { | 132 virtual int GetPeerAddress(IPEndPoint* address) const { |
| 133 return ERR_UNEXPECTED; | 133 return ERR_UNEXPECTED; |
| 134 } | 134 } |
| 135 virtual int GetLocalAddress(IPEndPoint* address) const { | 135 virtual int GetLocalAddress(IPEndPoint* address) const { |
| 136 return ERR_UNEXPECTED; | 136 return ERR_UNEXPECTED; |
| 137 } | 137 } |
| 138 virtual const BoundNetLog& NetLog() const { | 138 virtual const BoundNetLog& NetLog() const { |
| 139 return net_log_; | 139 return net_log_; |
| 140 } | 140 } |
| 141 | 141 |
| 142 virtual void SetSubresourceSpeculation() {} | 142 virtual void SetSubresourceSpeculation() {} |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 virtual void Disconnect() {} | 200 virtual void Disconnect() {} |
| 201 | 201 |
| 202 virtual bool IsConnected() const { | 202 virtual bool IsConnected() const { |
| 203 return is_connected_; | 203 return is_connected_; |
| 204 } | 204 } |
| 205 virtual bool IsConnectedAndIdle() const { | 205 virtual bool IsConnectedAndIdle() const { |
| 206 return is_connected_; | 206 return is_connected_; |
| 207 } | 207 } |
| 208 virtual int GetPeerAddress(AddressList* address) const { | 208 virtual int GetPeerAddress(IPEndPoint* address) const { |
| 209 return ERR_UNEXPECTED; | 209 return ERR_UNEXPECTED; |
| 210 } | 210 } |
| 211 virtual int GetLocalAddress(IPEndPoint* address) const { | 211 virtual int GetLocalAddress(IPEndPoint* address) const { |
| 212 if (!is_connected_) | 212 if (!is_connected_) |
| 213 return ERR_SOCKET_NOT_CONNECTED; | 213 return ERR_SOCKET_NOT_CONNECTED; |
| 214 if (addrlist_.front().GetFamily() == AF_INET) | 214 if (addrlist_.front().GetFamily() == AF_INET) |
| 215 SetIPv4Address(address); | 215 SetIPv4Address(address); |
| 216 else | 216 else |
| 217 SetIPv6Address(address); | 217 SetIPv6Address(address); |
| 218 return OK; | 218 return OK; |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 EXPECT_TRUE(handle.socket()); | 1253 EXPECT_TRUE(handle.socket()); |
| 1254 IPEndPoint endpoint; | 1254 IPEndPoint endpoint; |
| 1255 handle.socket()->GetLocalAddress(&endpoint); | 1255 handle.socket()->GetLocalAddress(&endpoint); |
| 1256 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); | 1256 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); |
| 1257 EXPECT_EQ(1, client_socket_factory_.allocation_count()); | 1257 EXPECT_EQ(1, client_socket_factory_.allocation_count()); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 } // namespace | 1260 } // namespace |
| 1261 | 1261 |
| 1262 } // namespace net | 1262 } // namespace net |
| OLD | NEW |