message: Address bug with PONG receiver leaks during disconnection
diff: @@ -854,15 +854,20 @@ impl Connection {
  /// # }
  /// ```
  pub fn flush_timeout(&self, duration: Duration) -> io::Result<()> {
  - // TODO(dlc) - bounded or oneshot?
  let (s, r) = crossbeam_channel::bounded(1);
  - {
  +
  + // We take out the mutex before sending a ping (which may fail)
  let mut pongs = self.shared_state.pongs.lock();
  - pongs.push_back(s);
  - }
  + // This will throw an error if the system is disconnected.
  self.shared_state.outbound.send_ping()?;
  + // We only push to the mutex if the ping was successfully queued.
  + // By holding the mutex across calls, we guarantee ordering in the
  + // queue.
  + pongs.push_back(s);
  + drop(pongs);
  +
  let success = r
  .recv_timeout(duration)
  .map_err(|_| Error::new(ErrorKind::TimedOut, "No response"))?;
  