Skip to content

Commit 4cd2d99

Browse files
committed
fixed #716 - ensure dynamic AgentClient refs are generally Send
1 parent 3f009e8 commit 4cd2d99

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

russh/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ tokio = { workspace = true, features = [
134134
] }
135135
rand.workspace = true
136136
shell-escape = "0.1"
137-
tokio-fd = "0.3"
138-
termion = "4"
139137
ratatui = "0.30"
140138
tempfile = "3.14.0"
141139

@@ -144,6 +142,10 @@ russh-sftp = "2.1.0"
144142
tokio.workspace = true
145143
tokio-stream.workspace = true
146144

145+
[target.'cfg(not(target_os = "windows"))'.dev-dependencies]
146+
tokio-fd = "0.3"
147+
termion = "4"
148+
147149
[package.metadata.docs.rs]
148150
all-features = true
149151

russh/src/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub enum AgentAuthError {
173173
}
174174

175175
#[cfg_attr(feature = "async-trait", async_trait::async_trait)]
176-
impl<R: AsyncRead + AsyncWrite + Unpin + Send + 'static> Signer
176+
impl<R: AsyncRead + AsyncWrite + Unpin + Send> Signer
177177
for crate::keys::agent::client::AgentClient<R>
178178
{
179179
type Error = AgentAuthError;

russh/src/keys/agent/client.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,23 @@ pub struct AgentClient<S: AgentStream> {
2525
buf: Vec<u8>,
2626
}
2727

28-
impl<S: AgentStream + Send + Unpin + 'static> AgentClient<S> {
28+
impl<S: AgentStream + Send + Unpin> AgentClient<S> {
2929
/// Wraps the internal stream in a Box<dyn _>, allowing different client
3030
/// implementations to have the same type
31-
pub fn dynamic(self) -> AgentClient<Box<dyn AgentStream + Send + Unpin + 'static>> {
31+
pub fn dynamic<'a>(self) -> AgentClient<Box<dyn AgentStream + Send + Unpin + 'a>>
32+
where
33+
S: 'a,
34+
{
3235
AgentClient {
3336
stream: Box::new(self.stream),
3437
buf: self.buf,
3538
}
3639
}
3740

38-
pub fn into_inner(self) -> Box<dyn AgentStream + Send + Unpin + 'static> {
41+
pub fn into_inner<'a>(self) -> Box<dyn AgentStream + Send + Unpin + 'a>
42+
where
43+
S: 'a,
44+
{
3945
Box::new(self.stream)
4046
}
4147
}

0 commit comments

Comments
 (0)