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>2018-10-14 21:50:47 +0300
committermichael-grunder <michael.grunder@gmail.com>2018-10-14 21:50:47 +0300
commit27df92208a6a7c712ae08407a430059ab8b0d1ad (patch)
tree7594dae4e09fe3133a31d3344001042c878ba509 /cluster_library.c
parent2e412373c47a574a1215756e79e6512a46e30cdc (diff)
Treat a -1 response from cluster_check_response as a timeout.
When cluster_check_response returns -1 this can be treated as a timeout. Note that there is one non-timout condition which can cause a -1 response, but that is a corrupted MOVE/ASK reply which can *probably* be treated as a timeout as well, because it means that something has gone horribly wrong with the connection. Addresses #1425
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cluster_library.c b/cluster_library.c
index 224932bf..4c785703 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -1439,8 +1439,9 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
}
}
- /* Figure out if we've timed out trying to read or write the data */
- timedout = resp && c->waitms ? mstime() - msstart >= c->waitms : 0;
+ /* We're timed out if cluster_check_response returned -1, or if the
+ * response was non-zero and we've been in the loop too long */
+ timedout = resp == -1 || (resp && c->waitms ? mstime() - msstart >= c->waitms : 0);
} while (resp != 0 && !c->clusterdown && !timedout);
// If we've detected the cluster is down, throw an exception