Fix error when reset

If `Mplex` is cleanup first, `MplexStream.reset` possibly fails because
`Mplex.streams` is set to `None` in `cleanup`.
This commit is contained in:
mhchia 2019-09-14 14:57:43 +08:00
parent b51c2939a8
commit 4a689c7d57
No known key found for this signature in database
GPG Key ID: 389EFBEA1362589A

View File

@ -204,6 +204,10 @@ class MplexStream(IMuxedStream):
self.event_remote_closed.set()
async with self.mplex_conn.streams_lock:
if (
self.mplex_conn.streams is not None
and self.stream_id in self.mplex_conn.streams
):
del self.mplex_conn.streams[self.stream_id]
# TODO deadline not in use