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 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 27 matching lines...) Expand all Loading... |
38 // 2) RequestSocket returns OK with a newly connected socket. | 38 // 2) RequestSocket returns OK with a newly connected socket. |
39 // 3) RequestSocket returns ERR_IO_PENDING. The handle will be added to a | 39 // 3) RequestSocket returns ERR_IO_PENDING. The handle will be added to a |
40 // wait list until a socket is available to reuse or a new socket finishes | 40 // wait list until a socket is available to reuse or a new socket finishes |
41 // connecting. |priority| will determine the placement into the wait list. | 41 // connecting. |priority| will determine the placement into the wait list. |
42 // 4) An error occurred early on, so RequestSocket returns an error code. | 42 // 4) An error occurred early on, so RequestSocket returns an error code. |
43 // 5) A recoverable error occurred while setting up the socket. An error | 43 // 5) A recoverable error occurred while setting up the socket. An error |
44 // code is returned, but the |handle| is initialized with the new socket. | 44 // code is returned, but the |handle| is initialized with the new socket. |
45 // The caller must recover from the error before using the connection, or | 45 // The caller must recover from the error before using the connection, or |
46 // Disconnect the socket before releasing or resetting the |handle|. | 46 // Disconnect the socket before releasing or resetting the |handle|. |
47 // The current recoverable errors are: the errors accepted by | 47 // The current recoverable errors are: the errors accepted by |
48 // IsCertificateError(err) and PROXY_AUTH_REQUESTED when reported by | 48 // IsCertificateError(err) and PROXY_AUTH_REQUESTED, or |
49 // HttpProxyClientSocketPool. | 49 // HTTPS_PROXY_TUNNEL_RESPONSE when reported by HttpProxyClientSocketPool. |
50 // | 50 // |
51 // If this function returns OK, then |handle| is initialized upon return. | 51 // If this function returns OK, then |handle| is initialized upon return. |
52 // The |handle|'s is_initialized method will return true in this case. If a | 52 // The |handle|'s is_initialized method will return true in this case. If a |
53 // ClientSocket was reused, then ClientSocketPool will call | 53 // ClientSocket was reused, then ClientSocketPool will call |
54 // |handle|->set_reused(true). In either case, the socket will have been | 54 // |handle|->set_reused(true). In either case, the socket will have been |
55 // allocated and will be connected. A client might want to know whether or | 55 // allocated and will be connected. A client might want to know whether or |
56 // not the socket is reused in order to request a new socket if he encounters | 56 // not the socket is reused in order to request a new socket if he encounters |
57 // an error with the reused socket. | 57 // an error with the reused socket. |
58 // | 58 // |
59 // If ERR_IO_PENDING is returned, then the callback will be used to notify the | 59 // If ERR_IO_PENDING is returned, then the callback will be used to notify the |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 const scoped_refptr<SocketParams>& params, | 183 const scoped_refptr<SocketParams>& params, |
184 int num_sockets, | 184 int num_sockets, |
185 const BoundNetLog& net_log) { | 185 const BoundNetLog& net_log) { |
186 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); | 186 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); |
187 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 187 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
188 } | 188 } |
189 | 189 |
190 } // namespace net | 190 } // namespace net |
191 | 191 |
192 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 192 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |