ensured call the cancellation function for ssh connection

This commit is contained in:
hyung-hwan 2024-12-25 16:12:04 +09:00
parent 1681b34374
commit fcb7ae5ade
2 changed files with 10 additions and 8 deletions

View File

@ -68,7 +68,7 @@ func (spc *ServerPeerConn) RunTask(wg *sync.WaitGroup) {
// set up a timer to set waiting duration until the connection is
// 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:
for {
select {

View File

@ -454,7 +454,7 @@ func (pxy *server_proxy_http_main) ServeHTTP(w http.ResponseWriter, req *http.Re
client = &http.Client{
Transport: transport,
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 = transport.RoundTrip(proxy_req)
@ -617,14 +617,15 @@ func (pxy *server_proxy_ssh_ws) connect_ssh (ctx context.Context, username strin
User: username,
Auth: []ssh.AuthMethod{ ssh.Password(password) },
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
// if r.svc_option & RouteOption(ROUTE_OPTION_SSH) == 0 {
// REJECT??
//}
// TODO: timeout...
/* Is this protection needed?
if r.svc_option & RouteOption(ROUTE_OPTION_SSH) == 0 {
err = fmt.Errorf("peer not ssh")
goto oops
}
*/
addr = svc_addr_to_dst_addr(r.svc_addr);
@ -767,6 +768,7 @@ ws_recv_loop:
conn_ready_chan <- true
}
}
connect_ssh_cancel()
connect_ssh_cancel = nil
}()
}