mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 10:40:28 +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
@@ -585,6 +585,7 @@ void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p) {
|
||||
* the poll() function.
|
||||
* @returns SSH_OK No error.
|
||||
* SSH_ERROR Error happened during the poll.
|
||||
* SSH_AGAIN Timeout occured
|
||||
*/
|
||||
|
||||
int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout) {
|
||||
@@ -598,8 +599,10 @@ int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout) {
|
||||
return 0;
|
||||
|
||||
rc = ssh_poll(ctx->pollfds, ctx->polls_used, timeout);
|
||||
if(rc <= 0)
|
||||
if(rc < 0)
|
||||
return SSH_ERROR;
|
||||
if (rc == 0)
|
||||
return SSH_AGAIN;
|
||||
used = ctx->polls_used;
|
||||
for (i = 0; i < used && rc > 0; ) {
|
||||
if (!ctx->pollfds[i].revents) {
|
||||
|
||||
Reference in New Issue
Block a user