(self, cause: str = None)
| 325 | self.cleanup() |
| 326 | |
| 327 | def cleanup(self, cause: str = None) -> None: |
| 328 | self._closed_error = TargetClosedError(cause) if cause else TargetClosedError() |
| 329 | if self._init_task and not self._init_task.done(): |
| 330 | self._init_task.cancel() |
| 331 | for ws_connection in self._child_ws_connections: |
| 332 | ws_connection._transport.dispose() |
| 333 | for callback in self._callbacks.values(): |
| 334 | # To prevent 'Future exception was never retrieved' we ignore all callbacks that are no_reply. |
| 335 | if callback.no_reply: |
| 336 | continue |
| 337 | if callback.future.cancelled(): |
| 338 | continue |
| 339 | callback.future.set_exception(self._closed_error) |
| 340 | self._callbacks.clear() |
| 341 | self.emit("close") |
| 342 | |
| 343 | def call_on_object_with_known_name( |
| 344 | self, guid: str, callback: Callable[[ChannelOwner], None] |
no test coverage detected