File tree Expand file tree Collapse file tree 3 files changed +18
-33
lines changed Expand file tree Collapse file tree 3 files changed +18
-33
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,13 @@ impl Session {
51
51
52
52
pub ( crate ) async fn request_port_forward (
53
53
& self ,
54
- forward_type : impl Into < ForwardType > ,
55
- listen_socket : impl Into < Socket < ' _ > > ,
56
- connect_socket : impl Into < Socket < ' _ > > ,
54
+ forward_type : ForwardType ,
55
+ listen_socket : Socket < ' _ > ,
56
+ connect_socket : Socket < ' _ > ,
57
57
) -> Result < ( ) , Error > {
58
58
Connection :: connect ( & self . ctl )
59
59
. await ?
60
- . request_port_forward (
61
- forward_type. into ( ) ,
62
- & listen_socket. into ( ) ,
63
- & connect_socket. into ( ) ,
64
- )
60
+ . request_port_forward ( forward_type, & listen_socket, & connect_socket)
65
61
. await ?;
66
62
67
63
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -104,18 +104,18 @@ impl Session {
104
104
105
105
pub ( crate ) async fn request_port_forward (
106
106
& self ,
107
- forward_type : impl Into < ForwardType > ,
108
- listen_socket : impl Into < Socket < ' _ > > ,
109
- connect_socket : impl Into < Socket < ' _ > > ,
107
+ forward_type : ForwardType ,
108
+ listen_socket : Socket < ' _ > ,
109
+ connect_socket : Socket < ' _ > ,
110
110
) -> Result < ( ) , Error > {
111
- let flag = match forward_type. into ( ) {
111
+ let flag = match forward_type {
112
112
ForwardType :: Local => OsStr :: new ( "-L" ) ,
113
113
ForwardType :: Remote => OsStr :: new ( "-R" ) ,
114
114
} ;
115
115
116
- let mut forwarding = listen_socket. into ( ) . as_os_str ( ) . into_owned ( ) ;
116
+ let mut forwarding = listen_socket. as_os_str ( ) . into_owned ( ) ;
117
117
forwarding. push ( ":" ) ;
118
- forwarding. push ( connect_socket. into ( ) . as_os_str ( ) ) ;
118
+ forwarding. push ( connect_socket. as_os_str ( ) ) ;
119
119
120
120
let port_forwarding = self
121
121
. new_cmd ( & [ OsStr :: new ( "-fNT" ) , flag, & * forwarding] )
Original file line number Diff line number Diff line change @@ -320,25 +320,14 @@ impl Session {
320
320
listen_socket : impl Into < Socket < ' _ > > ,
321
321
connect_socket : impl Into < Socket < ' _ > > ,
322
322
) -> Result < ( ) , Error > {
323
- async fn inner (
324
- this : & Session ,
325
- forward_type : ForwardType ,
326
- listen_socket : Socket < ' _ > ,
327
- connect_socket : Socket < ' _ > ,
328
- ) -> Result < ( ) , Error > {
329
- delegate ! ( & this. 0 , imp, {
330
- imp. request_port_forward( forward_type, listen_socket, connect_socket)
331
- . await
332
- } )
333
- }
334
-
335
- inner (
336
- self ,
337
- forward_type. into ( ) ,
338
- listen_socket. into ( ) ,
339
- connect_socket. into ( ) ,
340
- )
341
- . await
323
+ delegate ! ( & self . 0 , imp, {
324
+ imp. request_port_forward(
325
+ forward_type. into( ) . into( ) ,
326
+ listen_socket. into( ) . into( ) ,
327
+ connect_socket. into( ) . into( ) ,
328
+ )
329
+ . await
330
+ } )
342
331
}
343
332
344
333
/// Terminate the remote connection.
You can’t perform that action at this time.
0 commit comments