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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 24 matching lines...) Expand all Loading... |
35 // 1) RequestSocket returns OK and initializes |handle| with a reused socket. | 35 // 1) RequestSocket returns OK and initializes |handle| with a reused socket. |
36 // 2) RequestSocket returns OK with a newly connected socket. | 36 // 2) RequestSocket returns OK with a newly connected socket. |
37 // 3) RequestSocket returns ERR_IO_PENDING. The handle will be added to a | 37 // 3) RequestSocket returns ERR_IO_PENDING. The handle will be added to a |
38 // wait list until a socket is available to reuse or a new socket finishes | 38 // wait list until a socket is available to reuse or a new socket finishes |
39 // connecting. |priority| will determine the placement into the wait list. | 39 // connecting. |priority| will determine the placement into the wait list. |
40 // 4) An error occurred early on, so RequestSocket returns an error code. | 40 // 4) An error occurred early on, so RequestSocket returns an error code. |
41 // 5) A recoverable error occurred while setting up the socket. An error | 41 // 5) A recoverable error occurred while setting up the socket. An error |
42 // code is returned, but the |handle| is initialized with the new socket. | 42 // code is returned, but the |handle| is initialized with the new socket. |
43 // The caller must recover from the error before using the connection, or | 43 // The caller must recover from the error before using the connection, or |
44 // Disconnect the socket before releasing or resetting the |handle|. | 44 // Disconnect the socket before releasing or resetting the |handle|. |
45 // The current recoverable errors are: PROXY_AUTH_REQUESTED and the errors | 45 // The current recoverable errors are: the errors accepted by |
46 // accepted by IsCertificateError(err). | 46 // IsCertificateError(err) and PROXY_AUTH_REQUESTED when reported by |
| 47 // HttpProxyClientSocketPool. |
47 // | 48 // |
48 // If this function returns OK, then |handle| is initialized upon return. | 49 // If this function returns OK, then |handle| is initialized upon return. |
49 // The |handle|'s is_initialized method will return true in this case. If a | 50 // The |handle|'s is_initialized method will return true in this case. If a |
50 // ClientSocket was reused, then ClientSocketPool will call | 51 // ClientSocket was reused, then ClientSocketPool will call |
51 // |handle|->set_reused(true). In either case, the socket will have been | 52 // |handle|->set_reused(true). In either case, the socket will have been |
52 // allocated and will be connected. A client might want to know whether or | 53 // allocated and will be connected. A client might want to know whether or |
53 // not the socket is reused in order to request a new socket if he encounters | 54 // not the socket is reused in order to request a new socket if he encounters |
54 // an error with the reused socket. | 55 // an error with the reused socket. |
55 // | 56 // |
56 // If ERR_IO_PENDING is returned, then the callback will be used to notify the | 57 // If ERR_IO_PENDING is returned, then the callback will be used to notify the |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // should be optimized out by the compiler. | 149 // should be optimized out by the compiler. |
149 #define REGISTER_SOCKET_PARAMS_FOR_POOL(pool_type, socket_params) \ | 150 #define REGISTER_SOCKET_PARAMS_FOR_POOL(pool_type, socket_params) \ |
150 template<> \ | 151 template<> \ |
151 struct SocketParamTraits<pool_type, scoped_refptr<socket_params> > \ | 152 struct SocketParamTraits<pool_type, scoped_refptr<socket_params> > \ |
152 : public base::true_type { \ | 153 : public base::true_type { \ |
153 } | 154 } |
154 | 155 |
155 } // namespace net | 156 } // namespace net |
156 | 157 |
157 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 158 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |