Ejemplo n.º 1
0
    def __init__(self, path, funcs):
        self.server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        ctrl_path = os.path.join(path, 'ctrl')
        if os.path.exists(ctrl_path):
            os.unlink(ctrl_path)
        self.server.bind(ctrl_path)
        self.server.listen(1)
        os.chmod(ctrl_path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
        self.clients = {}
        self.funcs = funcs

        from brisa.core import reactor
        reactor.add_fd(self.server.fileno(), self.__accept, EVENT_TYPE_READ)
Ejemplo n.º 2
0
 def start(self):
     self.fd_id = reactor.add_fd(self.socket, self._receive_datagram,
                                 EVENT_TYPE_READ)
     NetworkListener.start(self)
Ejemplo n.º 3
0
 def start(self):
     self.fd_id = reactor.add_fd(self.socket, self._receive_datagram,
                                 EVENT_TYPE_READ)
     NetworkListener.start(self)
Ejemplo n.º 4
0
 def __accept(self, fd, evt):
     client, _ = self.server.accept()
     from brisa.core import reactor
     reactor.add_fd(client.fileno(), self.__read, EVENT_TYPE_READ | EVENT_TYPE_EXCEPTION)
     self.clients[client.fileno()] = IPCConnection(client)
     return True