diff options
author | michael-grunder <michael.grunder@gmail.com> | 2022-10-07 21:27:23 +0300 |
---|---|---|
committer | Michael Grunder <michael.grunder@gmail.com> | 2022-10-07 21:42:38 +0300 |
commit | ab4ce4ab6f6eadbae8245fef5486674eff0d1661 (patch) | |
tree | 50d6f5f280600baa4071757d06141b4b413ef406 | |
parent | b9950727f5c2fe25262e9e899bc31980d7e77f5c (diff) |
Allow negative timeout/read_timeout and fix doc
Co-authored-by: twosee <twose@qq.com>
-rw-r--r-- | README.markdown | 8 | ||||
-rw-r--r-- | cluster_library.c | 4 | ||||
-rw-r--r-- | redis.c | 4 | ||||
-rw-r--r-- | redis_sentinel.c | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/README.markdown b/README.markdown index d910bf34..5690c089 100644 --- a/README.markdown +++ b/README.markdown @@ -223,10 +223,10 @@ _**Description**_: Connects to a Redis instance. *host*: string. can be a host, or the path to a unix domain socket. Starting from version 5.0.0 it is possible to specify schema *port*: int, optional -*timeout*: float, value in seconds (optional, default is 0 meaning unlimited) +*timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout) *reserved*: should be '' if retry_interval is specified *retry_interval*: int, value in milliseconds (optional) -*read_timeout*: float, value in seconds (optional, default is 0 meaning unlimited) +*read_timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout) *others*: array, with PhpRedis >= 5.3.0, it allows setting _auth_ and [_stream_](https://www.php.net/manual/en/context.ssl.php) configuration. ##### *Return value* @@ -271,10 +271,10 @@ persistent equivalents. *host*: string. can be a host, or the path to a unix domain socket. Starting from version 5.0.0 it is possible to specify schema *port*: int, optional -*timeout*: float, value in seconds (optional, default is 0 meaning unlimited) +*timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout) *persistent_id*: string. identity for the requested persistent connection *retry_interval*: int, value in milliseconds (optional) -*read_timeout*: float, value in seconds (optional, default is 0 meaning unlimited) +*read_timeout*: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout) ##### *Return value* diff --git a/cluster_library.c b/cluster_library.c index 6e69c518..c76c3269 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -2873,12 +2873,12 @@ cluster_validate_args(double timeout, double read_timeout, HashTable *seeds, { zend_string **retval; - if (timeout < 0L || timeout > INT_MAX) { + if (timeout > INT_MAX) { if (errstr) *errstr = "Invalid timeout"; return NULL; } - if (read_timeout < 0L || read_timeout > INT_MAX) { + if (read_timeout > INT_MAX) { if (errstr) *errstr = "Invalid read timeout"; return NULL; } @@ -718,12 +718,12 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) persistent_id = NULL; } - if (timeout < 0L || timeout > INT_MAX) { + if (timeout > INT_MAX) { REDIS_VALUE_EXCEPTION("Invalid connect timeout"); return FAILURE; } - if (read_timeout < 0L || read_timeout > INT_MAX) { + if (read_timeout > INT_MAX) { REDIS_VALUE_EXCEPTION("Invalid read timeout"); return FAILURE; } diff --git a/redis_sentinel.c b/redis_sentinel.c index 5aa44420..55851f10 100644 --- a/redis_sentinel.c +++ b/redis_sentinel.c @@ -61,12 +61,12 @@ PHP_METHOD(RedisSentinel, __construct) RETURN_THROWS(); } - if (timeout < 0L || timeout > INT_MAX) { + if (timeout > INT_MAX) { REDIS_VALUE_EXCEPTION("Invalid connect timeout"); RETURN_THROWS(); } - if (read_timeout < 0L || read_timeout > INT_MAX) { + if (read_timeout > INT_MAX) { REDIS_VALUE_EXCEPTION("Invalid read timeout"); RETURN_THROWS(); } |