From d402a5b7e0d34e22aac131003f51cc800e273eaa Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 12 Dec 2022 20:28:43 +0100 Subject: [PATCH] Revert "Fix error with select when python process exceeds 1024 open file descriptors (#676)" (#685) This reverts commit 57fbbe11a922432419d12bde4030e28286247de6. --- pychromecast/socket_client.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pychromecast/socket_client.py b/pychromecast/socket_client.py index 1b9db96fd..702888c2b 100644 --- a/pychromecast/socket_client.py +++ b/pychromecast/socket_client.py @@ -565,15 +565,8 @@ def run_once(self, timeout=POLL_TIME_NON_BLOCKING): # poll the socket, as well as the socketpair to allow us to be interrupted rlist = [self.socket, self.socketpair[0]] - # Map file descriptors to socket objects because select.select does not support fd > 1024 - # https://stackoverflow.com/questions/14250751/how-to-increase-filedescriptors-range-in-python-select - fd_to_socket = {rlist_item.fileno(): rlist_item for rlist_item in rlist} try: - poll_obj = select.poll() - for poll_fd in rlist: - poll_obj.register(poll_fd, select.POLLIN) - poll_result = poll_obj.poll(timeout) - can_read = [fd_to_socket[fd] for fd, _status in poll_result] + can_read, _, _ = select.select(rlist, [], [], timeout) except (ValueError, OSError) as exc: self.logger.error( "[%s(%s):%s] Error in select call: %s",