Beispiel #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)
Beispiel #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)
Beispiel #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()
Beispiel #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()
Beispiel #5
0
 def __init__(self, pipe_in, pipe_out):
     self.box = MessageBox(pipe_in, pipe_out)
Beispiel #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)
Beispiel #7
0
	def __init__ (self, pipe_in, pipe_out):
		self.box = MessageBox(pipe_in, pipe_out)
Beispiel #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)