Skip to content

Commit 4d22a80

Browse files
committed
NO-JIRA: [Python] Fix exception in IOHandler.on_selectable_expired/update
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]>
1 parent a920192 commit 4d22a80

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/proton/_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,8 @@ def on_selectable_expired(self, event: Event) -> None:
12341234
t = s._transport
12351235
r = s._reactor
12361236

1237-
self.update(t, s, r.now)
1237+
if not s.is_terminal and t:
1238+
self.update(t, s, r.now)
12381239

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

0 commit comments

Comments
 (0)