proxy.core.acceptor.pool module#

proxy.py#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

copyright
  1. 2013-present by Abhinav Singh and contributors.

license

BSD, see LICENSE for more details.

class proxy.core.acceptor.pool.AcceptorPool(flags: argparse.Namespace, listeners: proxy.core.listener.pool.ListenerPool, executor_queues: List[multiprocessing.connection.Connection], executor_pids: List[int], executor_locks: List[multiprocessing.synchronize.Lock], event_queue: Optional[EventQueue] = None)[source]#

Bases: object

AcceptorPool is a helper class which pre-spawns Acceptor processes to utilize all available CPU cores for accepting new work.

A file descriptor to consume work from is shared with Acceptor processes over a pipe. Each Acceptor process then concurrently accepts new work over the shared file descriptor.

Example usage:

with AcceptorPool(flags=…) as pool:
while True:

time.sleep(1)

flags.work_klass must implement Work class.

_start() None[source]#

Start acceptor processes.

setup() None[source]#

Setup acceptors.

shutdown() None[source]#