

def _accept(self, fd, events):
    while True:
        try:
            (conn, addr) = self.socket.accept()
        except SocketError as exc:
            if (not would_block(exc)):
                raise
            return
        try:
            conn.setblocking(0)
            conn.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
            self.handler(conn, addr, self.io)
        except:
            logging.error(('TCPServer: conn error (%s)' % (addr,)), exc_info=True)
            self.io.remove_handler(conn.fileno())
            conn.close()

dataset/ETHPy150Open HenryHu/pybbs/xmpp/aio.py TCPServer._accept/original