Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2015-02-26 19:48:51 +0300
committermichael-grunder <michael.grunder@gmail.com>2015-05-06 01:05:30 +0300
commitf7f1e9d600f0974baa3ce09e4e2f97b18198b897 (patch)
tree78df96b16eb36bf221868ca02b9812270b495066 /cluster_library.c
parent043b360651651a5a7c53a93f2de4cd5c4989b6dc (diff)
We need to process the whole line when sending direct mode
commands
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cluster_library.c b/cluster_library.c
index cc40f37f..700e2c74 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -252,9 +252,15 @@ cluster_read_sock_resp(RedisSock *redis_sock, REDIS_REPLY_TYPE type,
static int cluster_send_direct(RedisSock *redis_sock, char *cmd, int cmd_len,
REDIS_REPLY_TYPE type TSRMLS_DC)
{
- /* Send the command and validate the reply type */
+ char buf[1024];
+
+ /* Connect to the socket if we aren't yet */
+ CLUSTER_LAZY_CONNECT(redis_sock);
+
+ /* Send our command, validate the reply type, and consume the first line */
if (!CLUSTER_SEND_PAYLOAD(redis_sock,cmd,cmd_len) ||
- !CLUSTER_VALIDATE_REPLY_TYPE(redis_sock, type)) return -1;
+ !CLUSTER_VALIDATE_REPLY_TYPE(redis_sock, type) ||
+ !php_stream_gets(redis_sock->stream, buf, sizeof(buf))) return -1;
/* Success! */
return 0;