mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-01 04:01:20 +00:00
mplex: fix destroy_substream (#469)
Retain all incoming buffer elements with different substream ID or equal Endpoint. The latter was previously not considered which could result in the removal of data for another substream with same ID but opposite Endpoint.
This commit is contained in:
parent
304e9c72c8
commit
ec6ec92a79
@ -506,7 +506,9 @@ where C: AsyncRead + AsyncWrite
|
||||
|
||||
fn destroy_substream(&self, mut substream: Self::Substream) {
|
||||
let _ = self.shutdown_substream(&mut substream); // TODO: this doesn't necessarily send the close message
|
||||
self.inner.lock().buffer.retain(|elem| elem.substream_id() != substream.num);
|
||||
self.inner.lock().buffer.retain(|elem| {
|
||||
elem.substream_id() != substream.num || elem.endpoint() == Some(substream.endpoint)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user