diff options
author | michael-grunder <michael.grunder@gmail.com> | 2014-07-11 19:52:44 +0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2015-05-06 01:04:12 +0300 |
commit | 3714ebb23db2fc7c978cac5154d820b3523f2525 (patch) | |
tree | 3499437dd731e844cbb52f9ad01617f38b6c1e2e /cluster_library.c | |
parent | 56419cdaa6482a66248f5573168b56b77b544034 (diff) |
PING response
Implemented PING for RedisCluster
Diffstat (limited to 'cluster_library.c')
-rw-r--r-- | cluster_library.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cluster_library.c b/cluster_library.c index b7213f76..833e33ec 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -1393,6 +1393,19 @@ PHPAPI void cluster_bool_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, CLUSTER_RETURN_BOOL(c, 1); } +/* Boolean response, specialized for PING */ +PHPAPI void cluster_ping_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, + void *ctx) +{ + if(c->reply_type != TYPE_LINE || c->reply_len != 4 || + memcmp(c->line_reply,"PONG",sizeof("PONG")-1)) + { + CLUSTER_RETURN_FALSE(c); + } + + CLUSTER_RETURN_BOOL(c, 1); +} + /* 1 or 0 response, for things like SETNX */ PHPAPI void cluster_1_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) |