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 bridge crashes on early channel opening failure #20880

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cockpit/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ async def create_transport(self, loop: asyncio.AbstractEventLoop, options: JsonO
raise NotImplementedError

def do_open(self, options: JsonObject) -> None:
self._transport = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong spot for that. Please move this to an initialization at the class level where all the other variables are initialized. I'm not sure why I missed this one...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know I despise instance variables that pretend to be class variables. That be the wrong spot IMO. If you insist I'll do it to get it out of the way, but this really belongs into the constructor (and open() is kinda sorta the constructor for Channels).

loop = asyncio.get_running_loop()
self._create_transport_task = asyncio.create_task(self.create_transport(loop, options))
self._create_transport_task.add_done_callback(self.create_transport_done)
Expand Down