mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
client: Fix another source of endless wait.
This commit is contained in:
committed by
Andreas Schneider
parent
7ccd9c31b3
commit
35686b4822
@@ -255,7 +255,7 @@ static int wait_auth_status(ssh_session session) {
|
|||||||
enter_function();
|
enter_function();
|
||||||
|
|
||||||
if(ssh_is_blocking(session)){
|
if(ssh_is_blocking(session)){
|
||||||
if(ssh_handle_packets_termination(session,-1,auth_status_termination,
|
if(ssh_handle_packets_termination(session, -2, auth_status_termination,
|
||||||
session) == SSH_ERROR){
|
session) == SSH_ERROR){
|
||||||
leave_function();
|
leave_function();
|
||||||
return SSH_AUTH_ERROR;
|
return SSH_AUTH_ERROR;
|
||||||
|
|||||||
26
src/client.c
26
src/client.c
@@ -628,19 +628,21 @@ int ssh_connect(ssh_session session) {
|
|||||||
session->alive = 1;
|
session->alive = 1;
|
||||||
ssh_log(session,SSH_LOG_PROTOCOL,"Socket connecting, now waiting for the callbacks to work");
|
ssh_log(session,SSH_LOG_PROTOCOL,"Socket connecting, now waiting for the callbacks to work");
|
||||||
pending:
|
pending:
|
||||||
session->pending_call_state=SSH_PENDING_CALL_CONNECT;
|
session->pending_call_state=SSH_PENDING_CALL_CONNECT;
|
||||||
if(ssh_is_blocking(session)) {
|
if(ssh_is_blocking(session)) {
|
||||||
int timeout = session->timeout * 1000 + session->timeout_usec;
|
int timeout = (session->timeout * 1000) + (session->timeout_usec / 1000);
|
||||||
if (timeout <= 0)
|
if (timeout == 0) {
|
||||||
timeout = -1;
|
timeout = 10 * 1000;
|
||||||
ssh_handle_packets_termination(session,timeout,ssh_connect_termination,session);
|
}
|
||||||
if(!ssh_connect_termination(session)){
|
ssh_log(session,SSH_LOG_PACKET,"ssh_connect: Actual timeout : %d", timeout);
|
||||||
ssh_set_error(session,SSH_FATAL,"Timeout connecting to %s",session->host);
|
ssh_handle_packets_termination(session, timeout, ssh_connect_termination, session);
|
||||||
session->session_state = SSH_SESSION_STATE_ERROR;
|
if(!ssh_connect_termination(session)){
|
||||||
}
|
ssh_set_error(session,SSH_FATAL,"Timeout connecting to %s",session->host);
|
||||||
}
|
session->session_state = SSH_SESSION_STATE_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ssh_handle_packets_termination(session,0,ssh_connect_termination, session);
|
ssh_handle_packets_termination(session, 0, ssh_connect_termination, session);
|
||||||
ssh_log(session,SSH_LOG_PACKET,"ssh_connect: Actual state : %d",session->session_state);
|
ssh_log(session,SSH_LOG_PACKET,"ssh_connect: Actual state : %d",session->session_state);
|
||||||
if(!ssh_is_blocking(session) && !ssh_connect_termination(session)){
|
if(!ssh_is_blocking(session) && !ssh_connect_termination(session)){
|
||||||
leave_function();
|
leave_function();
|
||||||
|
|||||||
Reference in New Issue
Block a user