diff --git a/asyncssh/channel.py b/asyncssh/channel.py index f99f493..5e70083 100644 --- a/asyncssh/channel.py +++ b/asyncssh/channel.py @@ -413,7 +413,11 @@ def _service_next_request(self) -> None: handler = cast(_RequestHandler, getattr(self, name, None)) if handler: - result = cast(Optional[bool], handler(packet)) + if self._session: + result = cast(Optional[bool], handler(packet)) + else: + # Ignore requests received after application closes the channel + result = True else: self.logger.debug1('Received unknown channel request: %s', request) result = False