ensured call the cancellation function for ssh connection
This commit is contained in:
parent
1681b34374
commit
fcb7ae5ade
@ -68,7 +68,7 @@ func (spc *ServerPeerConn) RunTask(wg *sync.WaitGroup) {
|
|||||||
|
|
||||||
// set up a timer to set waiting duration until the connection is
|
// set up a timer to set waiting duration until the connection is
|
||||||
// actually established on the client side and it's informed...
|
// actually established on the client side and it's informed...
|
||||||
waitctx, cancel_wait = context.WithTimeout(spc.route.cts.svr.ctx, 4 * time.Second)
|
waitctx, cancel_wait = context.WithTimeout(spc.route.cts.svr.ctx, 5 * time.Second) // TODO: make this configurable
|
||||||
wait_for_started:
|
wait_for_started:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@ -454,7 +454,7 @@ func (pxy *server_proxy_http_main) ServeHTTP(w http.ResponseWriter, req *http.Re
|
|||||||
client = &http.Client{
|
client = &http.Client{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
CheckRedirect: prevent_follow_redirect,
|
CheckRedirect: prevent_follow_redirect,
|
||||||
Timeout: 4 * time.Second, // TODO: make this configurable....
|
Timeout: 5 * time.Second, // TODO: make this configurable....
|
||||||
}
|
}
|
||||||
resp, err = client.Do(proxy_req)
|
resp, err = client.Do(proxy_req)
|
||||||
//resp, err = transport.RoundTrip(proxy_req)
|
//resp, err = transport.RoundTrip(proxy_req)
|
||||||
@ -617,14 +617,15 @@ func (pxy *server_proxy_ssh_ws) connect_ssh (ctx context.Context, username strin
|
|||||||
User: username,
|
User: username,
|
||||||
Auth: []ssh.AuthMethod{ ssh.Password(password) },
|
Auth: []ssh.AuthMethod{ ssh.Password(password) },
|
||||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
// Timeout: 2 * time.Second ,
|
// Timeout: 5 * time.Second , // timeout is also set on the passed ctx. it may not been needed here.
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK OPTIONS
|
/* Is this protection needed?
|
||||||
// if r.svc_option & RouteOption(ROUTE_OPTION_SSH) == 0 {
|
if r.svc_option & RouteOption(ROUTE_OPTION_SSH) == 0 {
|
||||||
// REJECT??
|
err = fmt.Errorf("peer not ssh")
|
||||||
//}
|
goto oops
|
||||||
// TODO: timeout...
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
addr = svc_addr_to_dst_addr(r.svc_addr);
|
addr = svc_addr_to_dst_addr(r.svc_addr);
|
||||||
|
|
||||||
@ -767,6 +768,7 @@ ws_recv_loop:
|
|||||||
conn_ready_chan <- true
|
conn_ready_chan <- true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
connect_ssh_cancel()
|
||||||
connect_ssh_cancel = nil
|
connect_ssh_cancel = nil
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user