Skip to content

Commit 424e88e

Browse files
SwelioEugeny
authored andcommitted
fix #143: handle CHANNEL_OPEN_FAILURE on server side
1 parent 2ce4334 commit 424e88e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

russh/src/server/encrypted.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,23 @@ impl Session {
894894
}
895895
}
896896
}
897+
Some(&msg::CHANNEL_OPEN_FAILURE) => {
898+
debug!("Channel open failed.");
899+
let mut buf_pos = buf.reader(1);
900+
let channel_num = ChannelId(buf_pos.read_u32().map_err(crate::Error::from)?);
901+
let reason =
902+
ChannelOpenFailure::from_u32(buf_pos.read_u32().map_err(crate::Error::from)?)
903+
.unwrap_or(ChannelOpenFailure::Unknown);
904+
let description =
905+
std::str::from_utf8(buf_pos.read_string().map_err(crate::Error::from)?)
906+
.map_err(crate::Error::from)?;
907+
let language_tag =
908+
std::str::from_utf8(buf_pos.read_string().map_err(crate::Error::from)?)
909+
.map_err(crate::Error::from)?;
910+
911+
self.channel_open_failure(channel_num, reason, description, language_tag);
912+
Ok((handler, self))
913+
}
897914
m => {
898915
debug!("unknown message received: {:?}", m);
899916
Ok((handler, self))

0 commit comments

Comments
 (0)