Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion async-ssh2-lite/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ where
{
pub fn new(stream: S) -> Result<Self, Error> {
let mut session = get_session(None)?;
session.set_tcp_stream(stream.as_raw_socket());
session.set_tcp_stream(crate::util::RawSocketWrapper(stream.as_raw_socket()));

let stream = Arc::new(stream);

Expand Down
2 changes: 1 addition & 1 deletion async-ssh2-lite/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
configuration: impl Into<Option<SessionConfiguration>>,
) -> Result<Self, Error> {
let mut session = get_session(configuration)?;
session.set_tcp_stream(stream.as_raw_socket());
session.set_tcp_stream(crate::util::RawSocketWrapper(stream.as_raw_socket()));

let stream = Arc::new(stream);

Expand Down
11 changes: 11 additions & 0 deletions async-ssh2-lite/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ impl ConnectInfo {
Self::Unix(path.as_ref().into())
}
}

#[cfg(windows)]
pub struct RawSocketWrapper(pub std::os::windows::io::RawSocket);

#[cfg(windows)]
impl std::os::windows::io::AsRawSocket for RawSocketWrapper {
#[inline]
fn as_raw_socket(&self) -> std::os::windows::io::RawSocket {
self.0
}
}