Skip to content

Commit

Permalink
NO-JIRA: [Python] Fix exception in IOHandler.on_selectable_expired/up…
Browse files Browse the repository at this point in the history
…date

This occasionally happens after my laptop wakes up from overnight sleep.

IOHandler.on_selectable_expired() is invoked with `selectable` that has
`_terminated=True` and `_transport=None` so when `IOHandler.update()`
is called it crashes when trying to handle the exception
(since transport is None).

Fix this by checking if transport attribute is set and that selectable is not
terminated before invoking `IOHandler.update()`.

Signed-off-by: Ievgen Popovych <[email protected]>
  • Loading branch information
Jmennius committed Mar 1, 2023
1 parent 3b0cfbc commit 8b75942
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/proton/_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,8 @@ def on_selectable_expired(self, event: Event) -> None:
t = s._transport
r = s._reactor

self.update(t, s, r.now)
if not s.is_terminal and t:
self.update(t, s, r.now)

def on_connection_local_open(self, event: Event) -> None:
c = event.connection
Expand Down

0 comments on commit 8b75942

Please sign in to comment.