Dispatch a lifecycle event to all registered handlers.
(self, event: SessionLifecycleEvent)
| 3229 | ) |
| 3230 | |
| 3231 | def _dispatch_lifecycle_event(self, event: SessionLifecycleEvent) -> None: |
| 3232 | """Dispatch a lifecycle event to all registered handlers.""" |
| 3233 | with self._lifecycle_handlers_lock: |
| 3234 | # Copy handlers to avoid holding lock during callbacks |
| 3235 | typed_handlers = list(self._typed_lifecycle_handlers.get(event.type, [])) |
| 3236 | wildcard_handlers = list(self._lifecycle_handlers) |
| 3237 | |
| 3238 | # Dispatch to typed handlers |
| 3239 | for handler in typed_handlers: |
| 3240 | try: |
| 3241 | handler(event) |
| 3242 | except Exception: |
| 3243 | pass # Ignore handler errors |
| 3244 | |
| 3245 | # Dispatch to wildcard handlers |
| 3246 | for handler in wildcard_handlers: |
| 3247 | try: |
| 3248 | handler(event) |
| 3249 | except Exception: |
| 3250 | pass # Ignore handler errors |
| 3251 | |
| 3252 | async def _verify_protocol_version(self) -> None: |
| 3253 | """Send the ``connect`` handshake (with the optional token) and verify |
no test coverage detected