Skip to content

Commit

Permalink
Fix ChannelStream's channel not being closed (#397)
Browse files Browse the repository at this point in the history
Co-authored-by: Eugene <inbox@null.page>
  • Loading branch information
EpicEric and Eugeny authored Dec 1, 2024
1 parent 2a4f451 commit fb8d3ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions russh/src/channels/io/rx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,16 @@ where
}
}
}

impl<'i, S> Drop for ChannelRx<'i, S>
where
S: From<(ChannelId, ChannelMsg)>,
{
fn drop(&mut self) {
if let ChannelAsMut::Owned(ref mut channel) = &mut self.channel {
let _ = channel
.sender
.try_send((channel.id, ChannelMsg::Close).into());
}
}
}

0 comments on commit fb8d3ea

Please sign in to comment.