示例#1
0
 def handle_event(self, eventmask: int) -> None:
     if eventmask & looping.POLLIN:
         try:
             helpers.loop_for_eagain(self.handle_new_incoming)
         except IOError as exc:
             if exc.errno in (errno.EMFILE, errno.ENFILE):
                 # Too many open files
                 self.logger.error("Cannot accept, too many open files")
                 # Shutdown the socket to try an clear the backlog,
                 # which should disconnect the client; then
                 # re-listen() on it immediately
                 self.sock.shutdown(socket.SHUT_RD)
                 self.sock.listen(self.BACKLOG)
             else:
                 raise
示例#2
0
文件: server.py 项目: RamuRC/savate
 def handle_event(self, eventmask):
     if eventmask & looping.POLLIN:
         try:
             helpers.loop_for_eagain(self.handle_new_incoming)
         except IOError as exc:
             if exc.errno in (errno.EMFILE, errno.ENFILE):
                 # Too many open files
                 self.logger.error('Cannot accept, too many open files')
                 # Shutdown the socket to try an clear the backlog,
                 # which should disconnect the client; then
                 # re-listen() on it immediately
                 self.sock.shutdown(socket.SHUT_RD)
                 self.sock.listen(self.BACKLOG)
             else:
                 raise
示例#3
0
文件: server.py 项目: abeutot/savate
 def handle_read(self):
     try:
         helpers.loop_for_eagain(self.handle_new_incoming)
     except IOError as exc:
         if exc.errno in (errno.ECONNABORTED, errno.EPROTO, errno.EINTR):
             pass
         elif exc.errno in (errno.EMFILE, errno.ENFILE):
             # Too many open files
             self.logger.error('Cannot accept, too many open files')
             # Try to close() and re-open our listening socket,
             # since there is no other way to clear the backlog
             # FIXME: remove from poller object, and try to
             # re-add it later ? Do not try to accept() once
             # we've reached the open file descriptors / max
             # clients limit ?
             self.stop()
             self.start()
         else:
             raise
示例#4
0
 def handle_event(self, eventmask):
     if eventmask & looping.POLLIN:
         helpers.loop_for_eagain(self.handle_new_incoming)
示例#5
0
文件: server.py 项目: xaiki/savate
 def handle_event(self, eventmask):
     if eventmask & looping.POLLIN:
         helpers.loop_for_eagain(self.handle_new_incoming)