示例#1
0
    def __init__(self, configuration, poller):
        self.low = configuration.redirector.minimum  # minimum concurrent redirector workers
        self.high = configuration.redirector.maximum  # maximum concurrent redirector workers

        self.poller = poller
        self.configuration = configuration
        self.queue = Queue(
        )  # store requests we do not immediately have the resources to process

        self.nextid = 1  # unique id to give to the next spawned worker
        self.worker = {}  # worker tasks for each spawned child
        self.processes = {
        }  # worker tasks indexed by file descriptors we can poll
        self.available = set(
        )  # workers that are currently available to handle new requests
        self.active = {
        }  # workers that are currently busy waiting for a response from the spawned process
        self.stopping = set(
        )  # workers we want to stop as soon as they stop being active

        program = configuration.redirector.program
        protocol = configuration.redirector.protocol
        self.redirector_factory = RedirectorFactory(configuration, program,
                                                    protocol)

        self.log = Logger('manager', configuration.log.manager)
示例#2
0
	def __init__ (self,configuration,poller):
		self.configuration = configuration

		self.low = configuration.redirector.minimum       # minimum number of workers at all time
		self.high = configuration.redirector.maximum      # maximum numbe of workers at all time
		self.program = configuration.redirector.program   # what program speaks the squid redirector API

		self.nextid = 1                   # incremental number to make the name of the next worker
		self.queue = Queue()              # queue with HTTP headers to process
		self.poller = poller              # poller interface that checks for events on sockets
		self.worker = {}                  # our workers threads
		self.closing = set()              # workers that are currently closing
		self.running = True               # we are running

		self.log = Logger('manager', configuration.log.manager)
示例#3
0
 def __init__(self, messagebox):
     self.messagebox = messagebox
     self.queue = Queue()
     self.thread = self.dispatcher_factory(messagebox, self.queue)