Skip to content

Commit f35fbff

Browse files
z0017k9mEugeny
authored andcommitted
fix channel close issue
1 parent 4388abb commit f35fbff

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

russh/src/client/encrypted.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,7 @@ impl Session {
340340
if let Some(ref mut enc) = self.common.encrypted {
341341
// The CHANNEL_CLOSE message must be sent to the server at this point or the session
342342
// will not be released.
343-
if enc.channels.remove(&channel_num).is_some() {
344-
enc.byte(channel_num, msg::CHANNEL_CLOSE);
345-
}
343+
enc.close(channel_num);
346344
}
347345
client.channel_close(channel_num, self).await
348346
}

russh/src/session.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ impl Encrypted {
151151

152152
pub fn close(&mut self, channel: ChannelId) {
153153
self.byte(channel, msg::CHANNEL_CLOSE);
154+
self.channels.remove(&channel);
154155
}
155156

156157
pub fn sender_window_size(&self, channel: ChannelId) -> usize {

0 commit comments

Comments
 (0)