def __init__(self, pipelines=4): Dispatcher.__init__(self) self.Queue = Queue.PriorityQueue(-1) self.WaitingToQuit = False self.Workers = [] self.Lock = threading.Lock() self.Count = pipelines # indicates the number of available workers, used in IsFull() self.Log = open("dispatcher.log", "w") for i in range(pipelines): worker = threading.Thread(target=Worker, args=(self, i + 1)) worker.start() self.Workers.append(worker)
def __init__(self, sock_family, sock_type, bind_address, factory): Dispatcher.__init__(self) self.sock_family = sock_family self.sock_type = sock_type self.sock_type = sock_type self.bind_address = bind_address self.factory = factory if sock_family == socket.AF_UNIX: try: os.unlink(bind_address) except OSError: pass fd = socket.socket(self.sock_family, self.sock_type) fd.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) fd.bind(self.bind_address) fd.listen(5) self.fd = fd
def __init__(self, sock_family, sock_type, remote_address, fd=None): Dispatcher.__init__(self, fd) self.sock_family = sock_family self.sock_type = sock_type self.remote_address = remote_address self.read_buffer = Buffer(4096) self.write_buffer = Buffer(4096) self.uid = None self.gids = set() # For AF_UNIX sockets find out the uid/gids of the caller. if self.fd is not None and self.sock_family == socket.AF_UNIX: self.uid = utils.get_peer_uid(fd) self.gids = utils.uid_gids.get(self.uid, []) # Connect if this is client side. if self.client: self.handle_connect() print("uid:", self.uid, self.gids)
def __init__(self, id): Dispatcher.__init__(self) self.id = id
def __init__(self): Dispatcher.__init__(self)
def __init__(self, main): self.main = main Dispatcher.__init__(self, udpfilter, PacketFilterBase)