mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
misc: Fix ssh_timeout_update().
This commit is contained in:
committed by
Andreas Schneider
parent
a290fe33c1
commit
c31cac93f3
10
src/misc.c
10
src/misc.c
@@ -940,15 +940,15 @@ int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout) {
|
|||||||
* @param[in] ts pointer to an existing timestamp
|
* @param[in] ts pointer to an existing timestamp
|
||||||
* @param[in] timeout timeout in milliseconds. Negative values mean infinite
|
* @param[in] timeout timeout in milliseconds. Negative values mean infinite
|
||||||
* timeout
|
* timeout
|
||||||
* @returns remaining time in milliseconds, 0 if elapsed, -1 if never.
|
* @returns remaining time in milliseconds, 0 if elapsed, -1 if never,
|
||||||
|
* -2 if option-set-timeout.
|
||||||
*/
|
*/
|
||||||
int ssh_timeout_update(struct ssh_timestamp *ts, int timeout){
|
int ssh_timeout_update(struct ssh_timestamp *ts, int timeout){
|
||||||
struct ssh_timestamp now;
|
struct ssh_timestamp now;
|
||||||
int ms, ret;
|
int ms, ret;
|
||||||
if(timeout == 0)
|
if (timeout <= 0) {
|
||||||
return 0;
|
return timeout;
|
||||||
if(timeout==-1)
|
}
|
||||||
return -1;
|
|
||||||
ssh_timestamp_init(&now);
|
ssh_timestamp_init(&now);
|
||||||
ms = ssh_timestamp_difference(ts,&now);
|
ms = ssh_timestamp_difference(ts,&now);
|
||||||
if(ms < 0)
|
if(ms < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user