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-03-04 08:02:32 +0300
committermichael-grunder <michael.grunder@gmail.com>2015-05-06 01:16:50 +0300
commit54a521e2271641dd429c09ef3678e77ae4ab9bc2 (patch)
tree01f1325cd6c970abde6d5724cf2f74c566e947ce /cluster_library.c
parent469e8e93774d75c9649075ede1549aeedb68928b (diff)
Cluster fixes
* STRLEN should use cluster_long_response * Updated multibulk processing to return an empty array on *-1
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/cluster_library.c b/cluster_library.c
index d55a77b4..b49afc72 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -1785,21 +1785,23 @@ PHPAPI void cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
{
zval *z_result;
- // Verify our reply type byte is correct and that this isn't a NULL
- // (e.g. -1 count) multi bulk response.
- if(c->reply_type != TYPE_MULTIBULK || c->reply_len == -1) {
+ /* Return FALSE if we didn't get a multi-bulk response */
+ if (c->reply_type != TYPE_MULTIBULK) {
CLUSTER_RETURN_FALSE(c);
}
- // Allocate array
+ /* Allocate our array */
MAKE_STD_ZVAL(z_result);
array_init(z_result);
- // Call our specified callback
- if(cb(c->cmd_sock, z_result, c->reply_len, ctx TSRMLS_CC)==FAILURE) {
- zval_dtor(z_result);
- FREE_ZVAL(z_result);
- CLUSTER_RETURN_FALSE(c);
+ /* Consume replies as long as there are more than zero */
+ if (c->reply_len > 0) {
+ /* Call our specified callback */
+ if (cb(c->cmd_sock, z_result, c->reply_len, ctx TSRMLS_CC)==FAILURE) {
+ zval_dtor(z_result);
+ FREE_ZVAL(z_result);
+ CLUSTER_RETURN_FALSE(c);
+ }
}
// Success, make this array our return value