Browse Source

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

master
Tangent Wantwight 1 year ago
parent
commit
4dc8ec1bbd
  1. 3
      CHANGELOG.md
  2. 2
      Cargo.lock
  3. 2
      Cargo.toml
  4. 10
      src/channel.rs

3
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

2
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)",

2
Cargo.toml

@ -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"

10
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,

Loading…
Cancel
Save