diff options
author | antirez <antirez@gmail.com> | 2020-03-27 16:34:45 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2020-03-27 16:35:03 +0100 |
commit | dd7e61d77f8e74b2d502965cf43df8034cd7923e (patch) | |
tree | f5d1ac7e99e3d50f360752fcfaa4cafb4f9dda11 /src/blocked.c | |
parent | 0e22cb2680db9f87fd232bc54419d538629edc2d (diff) | |
download | redis-dd7e61d77f8e74b2d502965cf43df8034cd7923e.tar.gz |
timeout.c created: move client timeouts code there.
Diffstat (limited to 'src/blocked.c')
-rw-r--r-- | src/blocked.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/blocked.c b/src/blocked.c index 795985ea1..e3a803ae3 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -31,9 +31,6 @@ * * API: * - * getTimeoutFromObjectOrReply() is just an utility function to parse a - * timeout argument since blocking operations usually require a timeout. - * * blockClient() set the CLIENT_BLOCKED flag in the client, and set the * specified block type 'btype' filed to one of BLOCKED_* macros. * @@ -67,42 +64,6 @@ int serveClientBlockedOnList(client *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where); -/* Get a timeout value from an object and store it into 'timeout'. - * The final timeout is always stored as milliseconds as a time where the - * timeout will expire, however the parsing is performed according to - * the 'unit' that can be seconds or milliseconds. - * - * Note that if the timeout is zero (usually from the point of view of - * commands API this means no timeout) the value stored into 'timeout' - * is zero. */ -int getTimeoutFromObjectOrReply(client *c, robj *object, mstime_t *timeout, int unit) { - long long tval; - long double ftval; - - if (unit == UNIT_SECONDS) { - if (getLongDoubleFromObjectOrReply(c,object,&ftval, - "timeout is not an float or out of range") != C_OK) - return C_ERR; - tval = (long long) (ftval * 1000.0); - } else { - if (getLongLongFromObjectOrReply(c,object,&tval, - "timeout is not an integer or out of range") != C_OK) - return C_ERR; - } - - if (tval < 0) { - addReplyError(c,"timeout is negative"); - return C_ERR; - } - - if (tval > 0) { - tval += mstime(); - } - *timeout = tval; - - return C_OK; -} - /* Block a client for the specific operation type. Once the CLIENT_BLOCKED * flag is set client query buffer is not longer processed, but accumulated, * and will be processed when the client is unblocked. */ |