mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
Introduced ssh_timeout_elapsed functions
Functions to mesure elapsed time before and after a serie of
calls. Introduces a dependancy to clock_gettime() and librt,
hope this doesn't break anything. Porting to gettimeofday() should
not be too hard.
(cherry picked from commit 59f7647cd9)
This commit is contained in:
committed by
Andreas Schneider
parent
2624e603d4
commit
09b0018b93
16
src/client.c
16
src/client.c
@@ -685,12 +685,16 @@ int ssh_connect(ssh_session session) {
|
||||
ssh_log(session,SSH_LOG_PROTOCOL,"Socket connecting, now waiting for the callbacks to work");
|
||||
pending:
|
||||
session->pending_call_state=SSH_PENDING_CALL_CONNECT;
|
||||
if(ssh_is_blocking(session)) {
|
||||
int timeout = session->timeout * 1000 + session->timeout_usec;
|
||||
if (timeout <= 0)
|
||||
timeout = -1;
|
||||
ssh_handle_packets_termination(session,timeout,ssh_connect_termination,session);
|
||||
}
|
||||
if(ssh_is_blocking(session)) {
|
||||
int timeout = session->timeout * 1000 + session->timeout_usec;
|
||||
if (timeout <= 0)
|
||||
timeout = -1;
|
||||
ssh_handle_packets_termination(session,timeout,ssh_connect_termination,session);
|
||||
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
|
||||
ssh_handle_packets_termination(session,0,ssh_connect_termination, session);
|
||||
ssh_log(session,SSH_LOG_PACKET,"ssh_connect: Actual state : %d",session->session_state);
|
||||
|
||||
Reference in New Issue
Block a user