Skip to content

Commit

Permalink
Revert "Fix error with select when python process exceeds 1024 open f…
Browse files Browse the repository at this point in the history
…ile descriptors (#676)" (#685)

This reverts commit 57fbbe1.
  • Loading branch information
emontnemery authored Dec 12, 2022
1 parent feeba4f commit d402a5b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions pychromecast/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d402a5b

Please sign in to comment.