diff --git a/CHANGELOG.md b/CHANGELOG.md index cfd5163..f590dc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cargo.lock b/Cargo.lock index 7e2d3a4..703066e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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)", diff --git a/Cargo.toml b/Cargo.toml index ab42892..1dc41b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webmetro" -version = "0.3.0-dev" +version = "0.3.1-dev" authors = ["Tangent 128 "] edition = "2018" diff --git a/src/channel.rs b/src/channel.rs index e52c4a5..d72c65f 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -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,