when disconnecting, clean up the header chunk so subsequent clients don't get a potentially incorrect initialization segment

This commit is contained in:
Tangent Wantwight 2020-08-10 18:45:14 -04:00
parent d585ad7b31
commit 4dc8ec1bbd
4 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,6 @@
## v0.3.1-dev
- forget a channel's initialization segment when no transmitter is active. This improves behavior when a channel is occasionally used for streams with different codecs.
## v0.3.0
- update internals to v0.2 of `warp` and `tokio`; no remaining code relies on `futures` 0.1

2
Cargo.lock generated
View File

@ -1227,7 +1227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "webmetro"
version = "0.3.0-dev"
version = "0.3.1-dev"
dependencies = [
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,6 +1,6 @@
[package]
name = "webmetro"
version = "0.3.0-dev"
version = "0.3.1-dev"
authors = ["Tangent 128 <Tangent128@gmail.com>"]
edition = "2018"

View File

@ -57,6 +57,16 @@ impl Transmitter {
}
}
impl Drop for Transmitter {
fn drop(&mut self) {
if let Ok(mut channel) = self.channel.lock() {
// when disconnecting, clean up the header chunk so subsequent
// clients don't get a potentially incorrect initialization segment
channel.header_chunk = None;
}
}
}
pub struct Listener {
/// not used in operation, but its refcount keeps the channel alive when there's no Transmitter
_channel: Handle,