Flush pending packets after a key re-exchange

pmeunier
Jul 5, 2021, 9:19 AM
J4ZEHJHG4NGTGJPU5YMBW7IRTVZ7WOHIWI45FGM3Q3A7JHDTTXQAC

Dependencies

  • [2] T2FSTMJO Fixing a rekey loop
  • [3] EXXUR33Q Fixing queues when sending a vector
  • [4] 7FRJYUI6 Reboot because of a bad change
  • [5] 2WEO7OZL Version updates: getting rid of anyhow + moving to Tokio 1.0
  • [6] F2FHFNIK Fixing the return value of session::data_noqueue

Change contents

  • edit in thrussh/src/session.rs at line 196
    [3.178479]
    [3.178479]
    pub fn flush_all_pending(&mut self) {
    for (_, channel) in self.channels.iter_mut() {
    while let Some((buf, a, from)) = channel.pending_data.pop_front() {
    let size = Self::data_noqueue(&mut self.write, channel, &buf, from);
    if from + size < buf.len() {
    channel.pending_data.push_front((buf, a, from + size));
    break;
    }
    }
    }
    }
  • replacement in thrussh/src/session.rs at line 255
    [3.179943][3.179943:179993]()
    if !channel.pending_data.is_empty() {
    [3.179943]
    [3.179993]
    if !channel.pending_data.is_empty() || self.rekey.is_some() {
  • replacement in thrussh/src/server/encrypted.rs at line 36
    [3.231313][3.231313:231347]()
    debug!("read_encrypted");
    [3.231313]
    [3.231347]
    debug!(
    "server_read_encrypted, buf = {:?}",
    &buf[..buf.len().min(20)]
    );
  • edit in thrussh/src/server/encrypted.rs at line 67
    [3.232563]
    [3.232563]
    self.flush()?;
  • edit in thrussh/src/server/encrypted.rs at line 79
    [3.232910]
    [3.232910]
    self.flush()?;
  • edit in thrussh/src/server/encrypted.rs at line 88
    [2.112]
    [3.233115]
  • edit in thrussh/src/server/encrypted.rs at line 90
    [3.233171]
    [3.233171]
    enc.flush_all_pending();
  • edit in thrussh/src/server/encrypted.rs at line 92
    [3.233217]
    [3.233217]
    self.flush()?;
  • replacement in thrussh/src/client/encrypted.rs at line 40
    [3.385187][3.385187:385226]()
    &buf[..buf.len().min(100)]
    [3.385187]
    [3.385226]
    &buf[..buf.len().min(20)]
  • edit in thrussh/src/client/encrypted.rs at line 71
    [3.386650]
    [3.386650]
    self.flush()?;
  • edit in thrussh/src/client/encrypted.rs at line 104
    [3.388084]
    [3.388084]
    enc.flush_all_pending();
  • edit in thrussh/src/client/encrypted.rs at line 106
    [3.388134]
    [3.388134]
    self.flush()?;