Пример #1
0
 def connect(self, server: IRCServer.Server) -> bool:
     try:
         server.connect()
     except Exception as e:
         self.log.warn("Failed to connect to %s: %s", [str(server), str(e)])
         return False
     self.servers[server.fileno()] = server
     self.poll.register(server.fileno(), select.EPOLLOUT)
     return True
Пример #2
0
 def connect(self, server: IRCServer.Server) -> bool:
     try:
         server.connect()
     except Exception as e:
         self.log.warn("Failed to connect to %s: %s",
             [str(server), str(e)])
         return False
     self.servers[server.fileno()] = server
     self.poll.register(server.fileno(), select.EPOLLOUT)
     return True
Пример #3
0
 def connect(self, server: IRCServer.Server) -> bool:
     try:
         server.connect()
     except Exception as e:
         self.log.warn("Failed to connect to %s: %s", [str(server), str(e)])
         self.log.debug("Connection failure reason:", exc_info=True)
         return False
     self.servers[server.fileno()] = server
     self._read_poll.register(server.fileno(), select.POLLIN)
     return True
Пример #4
0
 def disconnect(self, server: IRCServer.Server):
     try:
         self.poll.unregister(server.fileno())
     except FileNotFoundError:
         pass
     del self.servers[server.fileno()]
Пример #5
0
 def register_both(self, server: IRCServer.Server):
     self.poll.modify(server.fileno(),
         select.EPOLLIN|select.EPOLLOUT)
Пример #6
0
 def register_write(self, server: IRCServer.Server):
     self.poll.modify(server.fileno(), select.EPOLLOUT)
Пример #7
0
 def register_read(self, server: IRCServer.Server):
     self.poll.modify(server.fileno(), select.EPOLLIN)
Пример #8
0
 def disconnect(self, server: IRCServer.Server):
     try:
         self.poll.unregister(server.fileno())
     except FileNotFoundError:
         pass
     del self.servers[server.fileno()]
Пример #9
0
 def register_both(self, server: IRCServer.Server):
     self.poll.modify(server.fileno(), select.EPOLLIN | select.EPOLLOUT)
Пример #10
0
 def register_write(self, server: IRCServer.Server):
     self.poll.modify(server.fileno(), select.EPOLLOUT)
Пример #11
0
 def register_read(self, server: IRCServer.Server):
     self.poll.modify(server.fileno(), select.EPOLLIN)
Пример #12
0
 def disconnect(self, server: IRCServer.Server):
     del self.servers[server.fileno()]
     self._trigger_both()