From 1f073db776cdb5ed619e163e07e47d8792d59fa7 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 18 Oct 2021 07:56:22 -0700 Subject: [PATCH] ssh: flatten out session module --- wezterm-ssh/src/auth.rs | 2 +- wezterm-ssh/src/host.rs | 2 +- wezterm-ssh/src/lib.rs | 1 + wezterm-ssh/src/pty.rs | 7 +++---- wezterm-ssh/src/{session/mod.rs => session.rs} | 5 +---- wezterm-ssh/src/{session/inner.rs => sessioninner.rs} | 3 ++- 6 files changed, 9 insertions(+), 11 deletions(-) rename wezterm-ssh/src/{session/mod.rs => session.rs} (97%) rename wezterm-ssh/src/{session/inner.rs => sessioninner.rs} (99%) diff --git a/wezterm-ssh/src/auth.rs b/wezterm-ssh/src/auth.rs index 2b1e452c1..192fee578 100644 --- a/wezterm-ssh/src/auth.rs +++ b/wezterm-ssh/src/auth.rs @@ -29,7 +29,7 @@ impl AuthenticationEvent { } } -impl crate::session::SessionInner { +impl crate::sessioninner::SessionInner { fn agent_auth(&mut self, sess: &ssh2::Session, user: &str) -> anyhow::Result { if let Some(only) = self.config.get("identitiesonly") { if only == "yes" { diff --git a/wezterm-ssh/src/host.rs b/wezterm-ssh/src/host.rs index 9e165535e..c9e4f6b37 100644 --- a/wezterm-ssh/src/host.rs +++ b/wezterm-ssh/src/host.rs @@ -21,7 +21,7 @@ impl HostVerificationEvent { } } -impl crate::session::SessionInner { +impl crate::sessioninner::SessionInner { pub fn host_verification_libssh( &mut self, sess: &libssh::Session, diff --git a/wezterm-ssh/src/lib.rs b/wezterm-ssh/src/lib.rs index 0c5aca752..dc6622fdf 100644 --- a/wezterm-ssh/src/lib.rs +++ b/wezterm-ssh/src/lib.rs @@ -5,6 +5,7 @@ mod filewrap; mod host; mod pty; mod session; +mod sessioninner; mod sessionwrap; mod sftp; diff --git a/wezterm-ssh/src/pty.rs b/wezterm-ssh/src/pty.rs index 372b49e3b..6741c9270 100644 --- a/wezterm-ssh/src/pty.rs +++ b/wezterm-ssh/src/pty.rs @@ -1,6 +1,5 @@ -use crate::session::{ - ChannelId, ChannelInfo, DescriptorState, SessionRequest, SessionSender, SignalChannel, -}; +use crate::session::{SessionRequest, SessionSender, SignalChannel}; +use crate::sessioninner::{ChannelId, ChannelInfo, DescriptorState}; use crate::sessionwrap::SessionWrap; use filedescriptor::{socketpair, FileDescriptor}; use portable_pty::{ExitStatus, PtySize}; @@ -165,7 +164,7 @@ impl portable_pty::Child for SshChildProcess { } } -impl crate::session::SessionInner { +impl crate::sessioninner::SessionInner { pub fn new_pty(&mut self, sess: &mut SessionWrap, newpty: &NewPty) -> anyhow::Result<()> { sess.set_blocking(true); diff --git a/wezterm-ssh/src/session/mod.rs b/wezterm-ssh/src/session.rs similarity index 97% rename from wezterm-ssh/src/session/mod.rs rename to wezterm-ssh/src/session.rs index b8ee8d821..4cc7ce562 100644 --- a/wezterm-ssh/src/session/mod.rs +++ b/wezterm-ssh/src/session.rs @@ -1,9 +1,8 @@ use crate::auth::*; -use crate::channelwrap::ChannelWrap; use crate::config::ConfigMap; use crate::host::*; use crate::pty::*; -pub(crate) use crate::session::inner::*; +use crate::sessioninner::*; use crate::sftp::{Sftp, SftpRequest}; use filedescriptor::{socketpair, FileDescriptor}; use portable_pty::PtySize; @@ -12,8 +11,6 @@ use std::collections::HashMap; use std::io::Write; use std::sync::{Arc, Mutex}; -mod inner; - #[derive(Debug)] pub enum SessionEvent { Banner(Option), diff --git a/wezterm-ssh/src/session/inner.rs b/wezterm-ssh/src/sessioninner.rs similarity index 99% rename from wezterm-ssh/src/session/inner.rs rename to wezterm-ssh/src/sessioninner.rs index c1885194c..934c9d982 100644 --- a/wezterm-ssh/src/session/inner.rs +++ b/wezterm-ssh/src/sessioninner.rs @@ -1,7 +1,8 @@ +use crate::channelwrap::ChannelWrap; use crate::config::ConfigMap; use crate::filewrap::FileWrap; use crate::pty::*; -use crate::session::{ChannelWrap, Exec, ExecResult, SessionEvent, SessionRequest, SignalChannel}; +use crate::session::{Exec, ExecResult, SessionEvent, SessionRequest, SignalChannel}; use crate::sessionwrap::SessionWrap; use crate::sftp::{ self, File, FileId, FileRequest, Metadata, SftpChannelError, SftpChannelResult, SftpRequest,