From f7f1e9d600f0974baa3ce09e4e2f97b18198b897 Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Thu, 26 Feb 2015 08:48:51 -0800 Subject: We need to process the whole line when sending direct mode commands --- cluster_library.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cluster_library.c') 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; -- cgit v1.2.3