@@ -108,7 +108,10 @@ impl Session {
108
108
#[ cfg( feature = "process-mux" ) ]
109
109
#[ cfg_attr( docsrs, doc( cfg( feature = "process-mux" ) ) ) ]
110
110
pub async fn connect < S : AsRef < str > > ( destination : S , check : KnownHosts ) -> Result < Self , Error > {
111
- Self :: connect_impl ( destination. as_ref ( ) , check, Session :: new_process_mux) . await
111
+ SessionBuilder :: default ( )
112
+ . known_hosts_check ( check)
113
+ . connect ( destination)
114
+ . await
112
115
}
113
116
114
117
/// Connect to the host at the given `host` over SSH using native mux impl, which
@@ -130,17 +133,10 @@ impl Session {
130
133
destination : S ,
131
134
check : KnownHosts ,
132
135
) -> Result < Self , Error > {
133
- Self :: connect_impl ( destination. as_ref ( ) , check, Session :: new_native_mux) . await
134
- }
135
-
136
- async fn connect_impl (
137
- destination : & str ,
138
- check : KnownHosts ,
139
- f : fn ( TempDir ) -> Session ,
140
- ) -> Result < Self , Error > {
141
- let mut s = SessionBuilder :: default ( ) ;
142
- s. known_hosts_check ( check) ;
143
- s. connect_impl ( destination, f) . await
136
+ SessionBuilder :: default ( )
137
+ . known_hosts_check ( check)
138
+ . connect_mux ( destination)
139
+ . await
144
140
}
145
141
146
142
/// Check the status of the underlying SSH connection.
0 commit comments