mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
To honor the actual millisecond timeout set via `libssh2_session_set_timeout()`, to open the possibility for the same in other APIs, and to use monotonic time if available. - add internal abstract time types and macros for handling point in time and time intervals, and use them throughout the codebase. - bump internal abstract time resolution to milliseconds (from seconds). Use signed 64-bit integers. - replace existing millisecond-resolution code in `libssh2_poll()` with the internal abstract time interface. - bump 'now' function to retrieve millisecond-resolution monotonic time from the system, if available. Also: - append `_s` or `_ms` to public API arguments to tell the time unit. - keepalive: minor tidy-ups. - make `ssh2_now()` return at least 1 in the fallback, `time(NULL)`-based codepath to not confuse a zero value with unset time. Credits: Stefan Eissing Ref:5649b21297Ref: https://github.com/curl/curl/pull/21034 - this leaves existing `ssh2_gettimeofday()` (together with its Windows-specific local implementation) with a single caller, `ssh2_deb_low()`. Refs: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html https://pubs.opengroup.org/onlinepubs/009604599/functions/gettimeofday.html https://www.man7.org/linux/man-pages/man2/gettimeofday.2.html https://learn.microsoft.com/windows/win32/api/profileapi/nf-profileapi-queryperformancefrequency https://learn.microsoft.com/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter https://stackoverflow.com/questions/5404277/porting-clock-gettime-to-windows Reported-and-patch-proposal-by: Trzik on github Based-on-patch-proposals-by: Ryan Kelley Fixes #1497 Ref: #1818 Closes #1893 Follow-up to772abc7a85#1919 Closes #2341
39 lines
746 B
Markdown
39 lines
746 B
Markdown
---
|
|
c: Copyright (C) The libssh2 project and its contributors.
|
|
SPDX-License-Identifier: BSD-3-Clause
|
|
Title: libssh2_session_set_timeout
|
|
Section: 3
|
|
Source: libssh2
|
|
See-also:
|
|
- libssh2_session_get_timeout(3)
|
|
---
|
|
|
|
# NAME
|
|
|
|
libssh2_session_set_timeout - set timeout for blocking functions
|
|
|
|
# SYNOPSIS
|
|
|
|
~~~c
|
|
#include <libssh2.h>
|
|
|
|
void libssh2_session_set_timeout(LIBSSH2_SESSION *session, long timeout_ms);
|
|
~~~
|
|
|
|
# DESCRIPTION
|
|
|
|
Set the **timeout_ms** in milliseconds for how long a blocking libssh2 function
|
|
call may wait before it considers the situation an error and returns
|
|
LIBSSH2_ERROR_TIMEOUT.
|
|
|
|
By default or if you set the timeout to zero, libssh2 has no timeout for
|
|
blocking functions.
|
|
|
|
# RETURN VALUE
|
|
|
|
Nothing
|
|
|
|
# AVAILABILITY
|
|
|
|
Added in 1.2.9
|