network.pool
Module¶
-
class
wpull.network.pool.
ConnectionPool
(max_host_count: int=6, resolver: typing.Union=None, connection_factory: typing.Union=None, ssl_connection_factory: typing.Union=None, max_count: int=100)[source]¶ Bases:
object
Connection pool.
Parameters: - max_host_count – Number of connections per host.
- resolver – DNS resolver.
- connection_factory – A function that accepts
address
andhostname
arguments and returns aConnection
instance. - ssl_connection_factory – A function that returns a
SSLConnection
instance. See connection_factory. - max_count – Limit on number of connections
-
acquire
(host: str, port: int, use_ssl: bool=False, host_key: typing.Any=None) → wpull.network.connection.Connection[source]¶ Return an available connection.
Parameters: - host – A hostname or IP address.
- port – Port number.
- use_ssl – Whether to return a SSL connection.
- host_key – If provided, it overrides the key used for per-host connection pooling. This is useful for proxies for example.
Coroutine.
-
clean
(force: bool=False)[source]¶ Clean all closed connections.
Parameters: force – Clean connected and idle connections too. Coroutine.
-
close
()[source]¶ Close all the connections and clean up.
This instance will not be usable after calling this method.
-
host_pools
¶
-
no_wait_release
(connection: wpull.network.connection.Connection)[source]¶ Synchronous version of
release()
.
-
class
wpull.network.pool.
HappyEyeballsConnection
(address, connection_factory, resolver, happy_eyeballs_table, is_ssl=False)[source]¶ Bases:
object
Wrapper for happy eyeballs connection.
-
class
wpull.network.pool.
HostPool
(connection_factory: typing.Callable, max_connections: int=6)[source]¶ Bases:
object
Connection pool for a host.
-
ready
¶ Queue
Connections not in use.
-
busy
¶ set
Connections in use.
-
acquire
() → wpull.network.connection.Connection[source]¶ Register and return a connection.
Coroutine.
-
clean
(force: bool=False)[source]¶ Clean closed connections.
Parameters: force – Clean connected and idle connections too. Coroutine.
-