Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iteration over message handlers #797

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

emontnemery
Copy link
Collaborator

@emontnemery emontnemery commented Jan 19, 2024

Handling of a message may cause a controller to unregister itself. Without the changes in this PR, this leads to a runtime error:

2024-01-19 11:58:15.996 ERROR (Thread-8) [pychromecast.socket_client] [Cellar display(192.168.0.114):8009] Unhandled exception in worker thread, attempting reconnect
Traceback (most recent call last):
  File "/home/erik/development/pychromecast_fork/pychromecast/socket_client.py", line 564, in run
    if self.run_once(timeout=POLL_TIME_BLOCKING) == 1:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/erik/development/pychromecast_fork/pychromecast/socket_client.py", line 669, in run_once
    self._route_message(message, data)
  File "/home/erik/development/pychromecast_fork/pychromecast/socket_client.py", line 741, in _route_message
    for handler in self._handlers[message.namespace]:
RuntimeError: Set changed size during iteration

@MartinHjelmare MartinHjelmare merged commit a773de8 into master Jan 22, 2024
1 check passed
@MartinHjelmare MartinHjelmare deleted the correct_message_handler_iteration branch January 22, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants