Exemple #1
0
class RedirectorToProxyMessageBox:
	def __init__ (self, pipe_in, pipe_out):
		self.box = MessageBox(pipe_in, pipe_out)

	def close (self):
		return self.box.close()

	def isClosed (self):
		return self.box.pipe_in.closed

	def getRequest (self):
		return self.box.get()

	def sendResponse (self, client_id, command, decision):
		message = client_id, command, decision
		return self.box.put(message)
Exemple #2
0
class RedirectorToProxyMessageBox:
    def __init__(self, pipe_in, pipe_out):
        self.box = MessageBox(pipe_in, pipe_out)

    def close(self):
        return self.box.close()

    def isClosed(self):
        return self.box.pipe_in.closed

    def getRequest(self):
        return self.box.get()

    def sendResponse(self, client_id, command, decision):
        message = client_id, command, decision
        return self.box.put(message)
Exemple #3
0
class ProxyToRedirectorMessageBox:
    def __init__(self, pid, pipe_in, pipe_out, control_in, control_out):
        self.pid = pid
        self.box = MessageBox(pipe_in, pipe_out)
        self.control = ControlBox(control_in, control_out)

    def close(self):
        return self.box.close()

    def sendRequest(self, client_id, accept_addr, accept_port, peer, request,
                    subrequest, source):
        message = client_id, accept_addr, accept_port, peer, request, subrequest, source
        return self.box.put(message)

    def getDecision(self):
        message = self.box.get()
        if message is not None:
            client_id, command, decision = message

        else:
            client_id, command, decision = None, None, None

        return client_id, command, decision

    def stop(self):
        self.control.send('STOP')
        return self.control.wait_stop()

    def respawn(self):
        self.control.send('RESPAWN')

    def decreaseSpawnLimit(self, count=1):
        self.control.send('DECREASE', count)

    def increaseSpawnLimit(self, count=1):
        self.control.send('INCREASE', count)

    def requestStats(self):
        identifier = self.control.send('STATS')

    def readResponse(self):
        return self.control.receive()
Exemple #4
0
class ProxyToRedirectorMessageBox:
	def __init__ (self, pid, pipe_in, pipe_out, control_in, control_out):
		self.pid = pid
		self.box = MessageBox(pipe_in, pipe_out)
		self.control = ControlBox(control_in, control_out)

	def close (self):
		return self.box.close()

	def sendRequest (self, client_id, peer, request, subrequest, source):
		message = client_id, peer, request, subrequest, source
		return self.box.put(message)

	def getDecision (self):
		message = self.box.get()
		if message is not None:
			client_id, command, decision = message

		else:
			client_id, command, decision = None, None, None

		return client_id, command, decision

	def stop (self):
		self.control.send('STOP')
		return self.control.wait_stop()

	def respawn (self):
		self.control.send('RESPAWN')

	def decreaseSpawnLimit (self, count=1):
		self.control.send('DECREASE', count)

	def increaseSpawnLimit (self, count=1):
		self.control.send('INCREASE', count)

	def requestStats (self):
		identifier = self.control.send('STATS')

	def readResponse (self):
		return self.control.receive()
Exemple #5
0
 def __init__(self, pipe_in, pipe_out):
     self.box = MessageBox(pipe_in, pipe_out)
Exemple #6
0
 def __init__(self, pid, pipe_in, pipe_out, control_in, control_out):
     self.pid = pid
     self.box = MessageBox(pipe_in, pipe_out)
     self.control = ControlBox(control_in, control_out)
Exemple #7
0
	def __init__ (self, pipe_in, pipe_out):
		self.box = MessageBox(pipe_in, pipe_out)
Exemple #8
0
	def __init__ (self, pid, pipe_in, pipe_out, control_in, control_out):
		self.pid = pid
		self.box = MessageBox(pipe_in, pipe_out)
		self.control = ControlBox(control_in, control_out)