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:
authorRemi Collet <remi@remirepo.net>2019-07-09 16:26:44 +0300
committerRemi Collet <remi@remirepo.net>2019-07-09 16:26:44 +0300
commit943802272a9557c513eb6b59f285e175ec734ad4 (patch)
treeb2043f3d762d36fd986a8b7bb75a2976d22cfd1a /cluster_library.c
parent28388abceeb217202eb48c6edb5fd8671d46068e (diff)
cleanup TSRMLS_* usage
Diffstat (limited to 'cluster_library.c')
-rw-r--r--cluster_library.c204
1 files changed, 102 insertions, 102 deletions
diff --git a/cluster_library.c b/cluster_library.c
index a9205cf6..767e95b0 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -114,7 +114,7 @@ void cluster_free_reply(clusterReply *reply, int free_data) {
static void
cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
clusterReply **element, int status_strings,
- int *err TSRMLS_DC)
+ int *err)
{
int i;
size_t sz;
@@ -126,7 +126,7 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
r = element[i] = ecalloc(1, sizeof(clusterReply));
// Bomb out, flag error condition on a communication failure
- if (redis_read_reply_type(sock, &r->type, &len TSRMLS_CC) < 0) {
+ if (redis_read_reply_type(sock, &r->type, &len) < 0) {
*err = 1;
return;
}
@@ -137,7 +137,7 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
switch(r->type) {
case TYPE_ERR:
case TYPE_LINE:
- if (redis_sock_gets(sock,buf,sizeof(buf),&sz TSRMLS_CC) < 0) {
+ if (redis_sock_gets(sock,buf,sizeof(buf),&sz) < 0) {
*err = 1;
return;
}
@@ -149,7 +149,7 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
break;
case TYPE_BULK:
if (r->len >= 0) {
- r->str = redis_sock_read_bulk_reply(sock,r->len TSRMLS_CC);
+ r->str = redis_sock_read_bulk_reply(sock,r->len);
if (!r->str) {
*err = 1;
return;
@@ -162,7 +162,7 @@ cluster_multibulk_resp_recursive(RedisSock *sock, size_t elements,
if (r->len > 0) {
r->element = ecalloc(r->len,sizeof(clusterReply*));
cluster_multibulk_resp_recursive(sock, r->elements, r->element,
- status_strings, err TSRMLS_CC);
+ status_strings, err);
}
if (*err) return;
}
@@ -197,17 +197,17 @@ static RedisSock *cluster_slot_sock(redisCluster *c, unsigned short slot,
}
/* Read the response from a cluster */
-clusterReply *cluster_read_resp(redisCluster *c, int status_strings TSRMLS_DC) {
+clusterReply *cluster_read_resp(redisCluster *c, int status_strings) {
return cluster_read_sock_resp(c->cmd_sock, c->reply_type,
status_strings ? c->line_reply : NULL,
- c->reply_len TSRMLS_CC);
+ c->reply_len);
}
/* Read any sort of response from the socket, having already issued the
* command and consumed the reply type and meta info (length) */
clusterReply*
cluster_read_sock_resp(RedisSock *redis_sock, REDIS_REPLY_TYPE type,
- char *line_reply, size_t len TSRMLS_DC)
+ char *line_reply, size_t len)
{
clusterReply *r;
@@ -230,7 +230,7 @@ cluster_read_sock_resp(RedisSock *redis_sock, REDIS_REPLY_TYPE type,
return r;
case TYPE_BULK:
r->len = len;
- r->str = redis_sock_read_bulk_reply(redis_sock, len TSRMLS_CC);
+ r->str = redis_sock_read_bulk_reply(redis_sock, len);
if (r->len != -1 && !r->str) {
cluster_free_reply(r, 1);
return NULL;
@@ -241,7 +241,7 @@ cluster_read_sock_resp(RedisSock *redis_sock, REDIS_REPLY_TYPE type,
if (len != (size_t)-1) {
r->element = ecalloc(len, sizeof(clusterReply*)*len);
cluster_multibulk_resp_recursive(redis_sock, len, r->element,
- line_reply != NULL, &err TSRMLS_CC);
+ line_reply != NULL, &err);
}
break;
default:
@@ -261,10 +261,10 @@ cluster_read_sock_resp(RedisSock *redis_sock, REDIS_REPLY_TYPE type,
/* Helper to open connection and send AUTH if necessary */
static zend_always_inline int
-cluster_sock_open(RedisSock *redis_sock TSRMLS_DC)
+cluster_sock_open(RedisSock *redis_sock)
{
zend_bool need_auth = (redis_sock->auth && redis_sock->status != REDIS_SOCK_STATUS_CONNECTED);
- if (!redis_sock_server_open(redis_sock TSRMLS_CC) && (!need_auth || !redis_sock_auth(redis_sock TSRMLS_CC))) {
+ if (!redis_sock_server_open(redis_sock) && (!need_auth || !redis_sock_auth(redis_sock ))) {
return SUCCESS;
}
return FAILURE;
@@ -277,7 +277,7 @@ cluster_sock_open(RedisSock *redis_sock TSRMLS_DC)
/* Send a command to the specific socket and validate reply type */
static int cluster_send_direct(RedisSock *redis_sock, char *cmd, int cmd_len,
- REDIS_REPLY_TYPE type TSRMLS_DC)
+ REDIS_REPLY_TYPE type)
{
char buf[1024];
@@ -290,15 +290,15 @@ static int cluster_send_direct(RedisSock *redis_sock, char *cmd, int cmd_len,
return 0;
}
-static int cluster_send_asking(RedisSock *redis_sock TSRMLS_DC) {
+static int cluster_send_asking(RedisSock *redis_sock) {
return cluster_send_direct(redis_sock, RESP_ASKING_CMD,
- sizeof(RESP_ASKING_CMD)-1, TYPE_LINE TSRMLS_CC);
+ sizeof(RESP_ASKING_CMD)-1, TYPE_LINE);
}
/* Send READONLY to a specific RedisSock unless it's already flagged as being
* in READONLY mode. If we can send the command, we flag the socket as being
* in that mode. */
-static int cluster_send_readonly(RedisSock *redis_sock TSRMLS_DC) {
+static int cluster_send_readonly(RedisSock *redis_sock) {
int ret;
/* We don't have to do anything if we're already in readonly mode */
@@ -306,7 +306,7 @@ static int cluster_send_readonly(RedisSock *redis_sock TSRMLS_DC) {
/* Return success if we can send it */
ret = cluster_send_direct(redis_sock, RESP_READONLY_CMD,
- sizeof(RESP_READONLY_CMD) - 1, TYPE_LINE TSRMLS_CC);
+ sizeof(RESP_READONLY_CMD) - 1, TYPE_LINE);
/* Flag this socket as READONLY if our command worked */
redis_sock->readonly = !ret;
@@ -316,9 +316,9 @@ static int cluster_send_readonly(RedisSock *redis_sock TSRMLS_DC) {
}
/* Send MULTI to a specific ReidsSock */
-static int cluster_send_multi(redisCluster *c, short slot TSRMLS_DC) {
+static int cluster_send_multi(redisCluster *c, short slot) {
if (cluster_send_direct(SLOT_SOCK(c,slot), RESP_MULTI_CMD,
- sizeof(RESP_MULTI_CMD) - 1, TYPE_LINE TSRMLS_CC) == 0)
+ sizeof(RESP_MULTI_CMD) - 1, TYPE_LINE) == 0)
{
c->cmd_sock->mode = MULTI;
return 0;
@@ -330,12 +330,12 @@ static int cluster_send_multi(redisCluster *c, short slot TSRMLS_DC) {
* here because we know we'll only have sent MULTI to the master nodes. We can't
* failover inside a transaction, as we don't know if the transaction will only
* be readonly commands, or contain write commands as well */
-PHP_REDIS_API int cluster_send_exec(redisCluster *c, short slot TSRMLS_DC) {
+PHP_REDIS_API int cluster_send_exec(redisCluster *c, short slot) {
int retval;
/* Send exec */
retval = cluster_send_slot(c, slot, RESP_EXEC_CMD, sizeof(RESP_EXEC_CMD)-1,
- TYPE_MULTIBULK TSRMLS_CC);
+ TYPE_MULTIBULK);
/* We'll either get a length corresponding to the number of commands sent to
* this node, or -1 in the case of EXECABORT or WATCH failure. */
@@ -345,9 +345,9 @@ PHP_REDIS_API int cluster_send_exec(redisCluster *c, short slot TSRMLS_DC) {
return retval;
}
-PHP_REDIS_API int cluster_send_discard(redisCluster *c, short slot TSRMLS_DC) {
+PHP_REDIS_API int cluster_send_discard(redisCluster *c, short slot) {
if (cluster_send_direct(SLOT_SOCK(c,slot), RESP_DISCARD_CMD,
- sizeof(RESP_DISCARD_CMD)-1, TYPE_LINE TSRMLS_CC))
+ sizeof(RESP_DISCARD_CMD)-1, TYPE_LINE))
{
return 0;
}
@@ -464,14 +464,14 @@ int cluster_dist_add_key(redisCluster *c, HashTable *ht, char *key,
/* Provided a clusterKeyVal, add a value */
void cluster_dist_add_val(redisCluster *c, clusterKeyVal *kv, zval *z_val
- TSRMLS_DC)
+ )
{
char *val;
size_t val_len;
int val_free;
// Serialize our value
- val_free = redis_pack(c->flags, z_val, &val, &val_len TSRMLS_CC);
+ val_free = redis_pack(c->flags, z_val, &val, &val_len);
// Attach it to the provied keyval entry
kv->val = val;
@@ -613,7 +613,7 @@ static void fyshuffle(int *array, size_t len) {
/* Execute a CLUSTER SLOTS command against the seed socket, and return the
* reply or NULL on failure. */
-clusterReply* cluster_get_slots(RedisSock *redis_sock TSRMLS_DC)
+clusterReply* cluster_get_slots(RedisSock *redis_sock)
{
clusterReply *r;
REDIS_REPLY_TYPE type;
@@ -621,14 +621,14 @@ clusterReply* cluster_get_slots(RedisSock *redis_sock TSRMLS_DC)
// Send the command to the socket and consume reply type
if (redis_sock_write(redis_sock, RESP_CLUSTER_SLOTS_CMD,
- sizeof(RESP_CLUSTER_SLOTS_CMD)-1 TSRMLS_CC) < 0 ||
- redis_read_reply_type(redis_sock, &type, &len TSRMLS_CC) < 0)
+ sizeof(RESP_CLUSTER_SLOTS_CMD)-1) < 0 ||
+ redis_read_reply_type(redis_sock, &type, &len) < 0)
{
return NULL;
}
// Consume the rest of our response
- if ((r = cluster_read_sock_resp(redis_sock, type, NULL, len TSRMLS_CC)) == NULL ||
+ if ((r = cluster_read_sock_resp(redis_sock, type, NULL, len)) == NULL ||
r->type != TYPE_MULTIBULK || r->elements < 1)
{
if (r) cluster_free_reply(r, 1);
@@ -774,7 +774,7 @@ PHP_REDIS_API void cluster_free_node(redisClusterNode *node) {
}
/* Get or create a redisClusterNode that corresponds to the asking redirection */
-static redisClusterNode *cluster_get_asking_node(redisCluster *c TSRMLS_DC) {
+static redisClusterNode *cluster_get_asking_node(redisCluster *c) {
redisClusterNode *pNode;
char key[1024];
int key_len;
@@ -797,8 +797,8 @@ static redisClusterNode *cluster_get_asking_node(redisCluster *c TSRMLS_DC) {
/* Get or create a node at the host:port we were asked to check, and return the
* redis_sock for it. */
-static RedisSock *cluster_get_asking_sock(redisCluster *c TSRMLS_DC) {
- return cluster_get_asking_node(c TSRMLS_CC)->sock;
+static RedisSock *cluster_get_asking_sock(redisCluster *c) {
+ return cluster_get_asking_node(c)->sock;
}
/* Our context seeds will be a hash table with RedisSock* pointers */
@@ -865,10 +865,10 @@ PHP_REDIS_API redisCluster *cluster_create(double timeout, double read_timeout,
}
PHP_REDIS_API void
-cluster_free(redisCluster *c, int free_ctx TSRMLS_DC)
+cluster_free(redisCluster *c, int free_ctx)
{
/* Disconnect from each node we're connected to */
- cluster_disconnect(c, 0 TSRMLS_CC);
+ cluster_disconnect(c, 0);
/* Free any allocated prefix */
if (c->flags->prefix) zend_string_release(c->flags->prefix);
@@ -1116,7 +1116,7 @@ cluster_init_seeds(redisCluster *cluster, HashTable *ht_seeds) {
}
/* Initial mapping of our cluster keyspace */
-PHP_REDIS_API int cluster_map_keyspace(redisCluster *c TSRMLS_DC) {
+PHP_REDIS_API int cluster_map_keyspace(redisCluster *c) {
RedisSock *seed;
clusterReply *slots = NULL;
int mapped = 0;
@@ -1124,12 +1124,12 @@ PHP_REDIS_API int cluster_map_keyspace(redisCluster *c TSRMLS_DC) {
// Iterate over seeds until we can get slots
ZEND_HASH_FOREACH_PTR(c->seeds, seed) {
// Attempt to connect to this seed node
- if (seed == NULL || cluster_sock_open(seed TSRMLS_CC) != 0) {
+ if (seed == NULL || cluster_sock_open(seed) != 0) {
continue;
}
// Parse out cluster nodes. Flag mapped if we are valid
- slots = cluster_get_slots(seed TSRMLS_CC);
+ slots = cluster_get_slots(seed);
if (slots) {
mapped = !cluster_map_slots(c, slots);
// Bin anything mapped, if we failed somewhere
@@ -1137,7 +1137,7 @@ PHP_REDIS_API int cluster_map_keyspace(redisCluster *c TSRMLS_DC) {
memset(c->master, 0, sizeof(redisClusterNode*)*REDIS_CLUSTER_SLOTS);
}
}
- redis_sock_disconnect(seed, 0 TSRMLS_CC);
+ redis_sock_disconnect(seed, 0);
if (mapped) break;
} ZEND_HASH_FOREACH_END();
@@ -1193,7 +1193,7 @@ static int cluster_set_redirection(redisCluster* c, char *msg, int moved)
* This function will return -1 on a critical error (e.g. parse/communication
* error, 0 if no redirection was encountered, and 1 if the data was moved. */
static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
- TSRMLS_DC)
+ )
{
size_t sz;
@@ -1201,7 +1201,7 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
CLUSTER_CLEAR_ERROR(c);
CLUSTER_CLEAR_REPLY(c);
- if (-1 == redis_check_eof(c->cmd_sock, 1 TSRMLS_CC) ||
+ if (-1 == redis_check_eof(c->cmd_sock, 1) ||
EOF == (*reply_type = php_stream_getc(c->cmd_sock->stream)))
{
return -1;
@@ -1237,7 +1237,7 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
// Fetch the first line of our response from Redis.
if (redis_sock_gets(c->cmd_sock,c->line_reply,sizeof(c->line_reply),
- &sz TSRMLS_CC) < 0)
+ &sz) < 0)
{
return -1;
}
@@ -1255,20 +1255,20 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
}
/* Disconnect from each node we're connected to */
-PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force TSRMLS_DC) {
+PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force) {
redisClusterNode *node, *slave;
ZEND_HASH_FOREACH_PTR(c->nodes, node) {
if (node == NULL) continue;
/* Disconnect from the master */
- redis_sock_disconnect(node->sock, force TSRMLS_CC);
+ redis_sock_disconnect(node->sock, force);
/* We also want to disconnect any slave connections so they will be pooled
* in the event we are using persistent connections and connection pooling. */
if (node->slaves) {
ZEND_HASH_FOREACH_PTR(node->slaves, slave) {
- redis_sock_disconnect(slave->sock, force TSRMLS_CC);
+ redis_sock_disconnect(slave->sock, force);
} ZEND_HASH_FOREACH_END();
}
} ZEND_HASH_FOREACH_END();
@@ -1277,7 +1277,7 @@ PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force TSRMLS_DC) {
/* This method attempts to write our command at random to the master and any
* attached slaves, until we either successufly do so, or fail. */
static int cluster_dist_write(redisCluster *c, const char *cmd, size_t sz,
- int nomaster TSRMLS_DC)
+ int nomaster)
{
int i, count = 1, *nodes;
RedisSock *redis_sock;
@@ -1308,7 +1308,7 @@ static int cluster_dist_write(redisCluster *c, const char *cmd, size_t sz,
/* If we're not on the master, attempt to send the READONLY command to
* this slave, and skip it if that fails */
if (nodes[i] == 0 || redis_sock->readonly ||
- cluster_send_readonly(redis_sock TSRMLS_CC) == 0)
+ cluster_send_readonly(redis_sock) == 0)
{
/* Attempt to send the command */
if (CLUSTER_SEND_PAYLOAD(redis_sock, cmd, sz)) {
@@ -1350,7 +1350,7 @@ static int cluster_dist_write(redisCluster *c, const char *cmd, size_t sz,
* ASKING redirection, such that the keyspace can be updated.
*/
static int cluster_sock_write(redisCluster *c, const char *cmd, size_t sz,
- int direct TSRMLS_DC)
+ int direct)
{
redisClusterNode *seed_node;
RedisSock *redis_sock;
@@ -1366,8 +1366,8 @@ static int cluster_sock_write(redisCluster *c, const char *cmd, size_t sz,
/* If in ASK redirection, get/create the node for that host:port, otherwise
* just use the command socket. */
if (c->redir_type == REDIR_ASK) {
- redis_sock = cluster_get_asking_sock(c TSRMLS_CC);
- if (cluster_send_asking(redis_sock TSRMLS_CC) < 0) {
+ redis_sock = cluster_get_asking_sock(c);
+ if (cluster_send_asking(redis_sock) < 0) {
return -1;
}
}
@@ -1383,12 +1383,12 @@ static int cluster_sock_write(redisCluster *c, const char *cmd, size_t sz,
} else if (failover == REDIS_FAILOVER_ERROR) {
/* Try the master, then fall back to any slaves we may have */
if (CLUSTER_SEND_PAYLOAD(redis_sock, cmd, sz) ||
- !cluster_dist_write(c, cmd, sz, 1 TSRMLS_CC)) return 0;
+ !cluster_dist_write(c, cmd, sz, 1)) return 0;
} else {
/* Include or exclude master node depending on failover option and
* attempt to make our write */
nomaster = failover == REDIS_FAILOVER_DISTRIBUTE_SLAVES;
- if (!cluster_dist_write(c, cmd, sz, nomaster TSRMLS_CC)) {
+ if (!cluster_dist_write(c, cmd, sz, nomaster)) {
/* We were able to write to a master or slave at random */
return 0;
}
@@ -1428,7 +1428,7 @@ static redisClusterNode *cluster_find_node(redisCluster *c, const char *host,
/* Provided a redisCluster object, the slot where we thought data was and
* the slot where data was moved, update our node mapping */
-static void cluster_update_slot(redisCluster *c TSRMLS_DC) {
+static void cluster_update_slot(redisCluster *c) {
redisClusterNode *node;
char key[1024];
size_t klen;
@@ -1481,14 +1481,14 @@ static void cluster_update_slot(redisCluster *c TSRMLS_DC) {
/* Abort any transaction in process, by sending DISCARD to any nodes that
* have active transactions in progress. If we can't send DISCARD, we need
* to disconnect as it would leave us in an undefined state. */
-PHP_REDIS_API int cluster_abort_exec(redisCluster *c TSRMLS_DC) {
+PHP_REDIS_API int cluster_abort_exec(redisCluster *c) {
clusterFoldItem *fi = c->multi_head;
/* Loop through our fold items */
while (fi) {
if (SLOT_SOCK(c,fi->slot)->mode == MULTI) {
- if (cluster_send_discard(c, fi->slot TSRMLS_CC) < 0) {
- cluster_disconnect(c, 0 TSRMLS_CC);
+ if (cluster_send_discard(c, fi->slot) < 0) {
+ cluster_disconnect(c, 0);
return -1;
}
SLOT_SOCK(c,fi->slot)->mode = ATOMIC;
@@ -1527,7 +1527,7 @@ PHP_REDIS_API short cluster_find_slot(redisCluster *c, const char *host,
/* Send a command to a specific slot */
PHP_REDIS_API int cluster_send_slot(redisCluster *c, short slot, char *cmd,
- int cmd_len, REDIS_REPLY_TYPE rtype TSRMLS_DC)
+ int cmd_len, REDIS_REPLY_TYPE rtype)
{
/* Point our cluster to this slot and it's socket */
c->cmd_slot = slot;
@@ -1536,19 +1536,19 @@ PHP_REDIS_API int cluster_send_slot(redisCluster *c, short slot, char *cmd,
/* Enable multi mode on this slot if we've been directed to but haven't
* send it to this node yet */
if (c->flags->mode == MULTI && c->cmd_sock->mode != MULTI) {
- if (cluster_send_multi(c, slot TSRMLS_CC) == -1) {
+ if (cluster_send_multi(c, slot) == -1) {
CLUSTER_THROW_EXCEPTION("Unable to enter MULTI mode on requested slot", 0);
return -1;
}
}
/* Try the slot */
- if (cluster_sock_write(c, cmd, cmd_len, 1 TSRMLS_CC) == -1) {
+ if (cluster_sock_write(c, cmd, cmd_len, 1) == -1) {
return -1;
}
/* Check our response */
- if (cluster_check_response(c, &c->reply_type TSRMLS_CC) != 0 ||
+ if (cluster_check_response(c, &c->reply_type) != 0 ||
(rtype != TYPE_EOF && rtype != c->reply_type)) return -1;
/* Success */
@@ -1558,7 +1558,7 @@ PHP_REDIS_API int cluster_send_slot(redisCluster *c, short slot, char *cmd,
/* Send a command to given slot in our cluster. If we get a MOVED or ASK error
* we attempt to send the command to the node as directed. */
PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char *cmd,
- int cmd_len TSRMLS_DC)
+ int cmd_len)
{
int resp, timedout = 0;
long msstart;
@@ -1585,7 +1585,7 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
/* Send MULTI to the socket if we're in MULTI mode but haven't yet */
if (c->flags->mode == MULTI && CMD_SOCK(c)->mode != MULTI) {
/* We have to fail if we can't send MULTI to the node */
- if (cluster_send_multi(c, slot TSRMLS_CC) == -1) {
+ if (cluster_send_multi(c, slot) == -1) {
CLUSTER_THROW_EXCEPTION("Unable to enter MULTI mode on requested slot", 0);
return -1;
}
@@ -1593,14 +1593,14 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
/* Attempt to deliver our command to the node, and that failing, to any
* node until we find one that is available. */
- if (cluster_sock_write(c, cmd, cmd_len, 0 TSRMLS_CC) == -1) {
+ if (cluster_sock_write(c, cmd, cmd_len, 0) == -1) {
/* We have to abort, as no nodes are reachable */
CLUSTER_THROW_EXCEPTION("Can't communicate with any node in the cluster", 0);
return -1;
}
/* Check response and short-circuit on success or communication error */
- resp = cluster_check_response(c, &c->reply_type TSRMLS_CC);
+ resp = cluster_check_response(c, &c->reply_type);
if (resp <= 0) {
break;
}
@@ -1615,7 +1615,7 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
/* Update mapping if the data has MOVED */
if (c->redir_type == REDIR_MOVED) {
- cluster_update_slot(c TSRMLS_CC);
+ cluster_update_slot(c);
c->cmd_sock = SLOT_SOCK(c, slot);
}
}
@@ -1630,7 +1630,7 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
return -1;
} else if (timedout || resp == -1) {
// Make sure the socket is reconnected, it such that it is in a clean state
- redis_sock_disconnect(c->cmd_sock, 1 TSRMLS_CC);
+ redis_sock_disconnect(c->cmd_sock, 1);
if (timedout) {
CLUSTER_THROW_EXCEPTION(
@@ -1666,7 +1666,7 @@ PHP_REDIS_API void cluster_bulk_raw_resp(INTERNAL_FUNCTION_PARAMETERS,
// Make sure we can read the response
if (c->reply_type != TYPE_BULK ||
- (resp = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len TSRMLS_CC)) == NULL)
+ (resp = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len)) == NULL)
{
if (c->flags->mode != MULTI) {
RETURN_FALSE;
@@ -1707,18 +1707,18 @@ PHP_REDIS_API void cluster_bulk_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster
// Make sure we can read the response
if (c->reply_type != TYPE_BULK ||
- (resp = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len TSRMLS_CC)) == NULL)
+ (resp = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len)) == NULL)
{
CLUSTER_RETURN_FALSE(c);
}
if (CLUSTER_IS_ATOMIC(c)) {
- if (!redis_unpack(c->flags, resp, c->reply_len, return_value TSRMLS_CC)) {
+ if (!redis_unpack(c->flags, resp, c->reply_len, return_value)) {
CLUSTER_RETURN_STRING(c, resp, c->reply_len);
}
} else {
zval z_unpacked;
- if (redis_unpack(c->flags, resp, c->reply_len, &z_unpacked TSRMLS_CC)) {
+ if (redis_unpack(c->flags, resp, c->reply_len, &z_unpacked)) {
add_next_index_zval(&c->multi_resp, &z_unpacked);
} else {
add_next_index_stringl(&c->multi_resp, resp, c->reply_len);
@@ -1736,7 +1736,7 @@ PHP_REDIS_API void cluster_dbl_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *
// Make sure we can read the response
if (c->reply_type != TYPE_BULK ||
- (resp = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len TSRMLS_CC)) == NULL)
+ (resp = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len)) == NULL)
{
CLUSTER_RETURN_FALSE(c);
}
@@ -1915,7 +1915,7 @@ PHP_REDIS_API void cluster_sub_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *
sctx->cb.param_count = tab_idx;
// Execute our callback
- if (zend_call_function(&(sctx->cb), &(sctx->cb_cache) TSRMLS_CC) !=
+ if (zend_call_function(&(sctx->cb), &(sctx->cb_cache)) !=
SUCCESS)
{
break;
@@ -2028,7 +2028,7 @@ cluster_variant_resp_generic(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
int i;
// Make sure we can read it
- if ((r = cluster_read_resp(c, status_strings TSRMLS_CC)) == NULL) {
+ if ((r = cluster_read_resp(c, status_strings)) == NULL) {
CLUSTER_RETURN_FALSE(c);
}
@@ -2140,7 +2140,7 @@ PHP_REDIS_API void cluster_gen_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
c->cmd_sock->serializer = c->flags->serializer;
/* Call our specified callback */
- if (cb(c->cmd_sock, &z_result, c->reply_len, ctx TSRMLS_CC) == FAILURE) {
+ if (cb(c->cmd_sock, &z_result, c->reply_len, ctx) == FAILURE) {
zval_dtor(&z_result);
CLUSTER_RETURN_FALSE(c);
}
@@ -2167,14 +2167,14 @@ PHP_REDIS_API int cluster_scan_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *
}
// Read the BULK size
- if (cluster_check_response(c, &c->reply_type TSRMLS_CC),0 ||
+ if (cluster_check_response(c, &c->reply_type),0 ||
c->reply_type != TYPE_BULK)
{
return FAILURE;
}
// Read the iterator
- if ((pit = redis_sock_read_bulk_reply(c->cmd_sock,c->reply_len TSRMLS_CC)) == NULL)
+ if ((pit = redis_sock_read_bulk_reply(c->cmd_sock,c->reply_len)) == NULL)
{
return FAILURE;
}
@@ -2184,7 +2184,7 @@ PHP_REDIS_API int cluster_scan_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *
efree(pit);
// We'll need another MULTIBULK response for the payload
- if (cluster_check_response(c, &c->reply_type TSRMLS_CC) < 0)
+ if (cluster_check_response(c, &c->reply_type) < 0)
{
return FAILURE;
}
@@ -2219,7 +2219,7 @@ PHP_REDIS_API void cluster_info_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster
char *info;
// Read our bulk response
- if ((info = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len TSRMLS_CC)) == NULL)
+ if ((info = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len)) == NULL)
{
CLUSTER_RETURN_FALSE(c);
}
@@ -2244,7 +2244,7 @@ PHP_REDIS_API void cluster_client_list_resp(INTERNAL_FUNCTION_PARAMETERS, redisC
zval z_result;
/* Read the bulk response */
- info = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len TSRMLS_CC);
+ info = redis_sock_read_bulk_reply(c->cmd_sock, c->reply_len);
if (info == NULL) {
CLUSTER_RETURN_FALSE(c);
}
@@ -2270,7 +2270,7 @@ cluster_xrange_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) {
c->cmd_sock->serializer = c->flags->serializer;
c->cmd_sock->compression = c->flags->compression;
- if (redis_read_stream_messages(c->cmd_sock, c->reply_len, &z_messages TSRMLS_CC) < 0) {
+ if (redis_read_stream_messages(c->cmd_sock, c->reply_len, &z_messages) < 0) {
zval_dtor(&z_messages);
CLUSTER_RETURN_FALSE(c);
}
@@ -2292,7 +2292,7 @@ cluster_xread_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) {
c->cmd_sock->serializer = c->flags->serializer;
c->cmd_sock->compression = c->flags->compression;
- if (redis_read_stream_messages_multi(c->cmd_sock, c->reply_len, &z_streams TSRMLS_CC) < 0) {
+ if (redis_read_stream_messages_multi(c->cmd_sock, c->reply_len, &z_streams) < 0) {
zval_dtor(&z_streams);
CLUSTER_RETURN_FALSE(c);
}
@@ -2311,7 +2311,7 @@ cluster_xclaim_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c, void *ctx) {
array_init(&z_msg);
- if (redis_read_xclaim_response(c->cmd_sock, c->reply_len, &z_msg TSRMLS_CC) < 0) {
+ if (redis_read_xclaim_response(c->cmd_sock, c->reply_len, &z_msg) < 0) {
zval_dtor(&z_msg);
CLUSTER_RETURN_FALSE(c);
}
@@ -2349,7 +2349,7 @@ PHP_REDIS_API zval *cluster_zval_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
ZVAL_NULL(z_ret);
// Pull our next response if directed
if (pull) {
- if (cluster_check_response(c, &c->reply_type TSRMLS_CC) < 0)
+ if (cluster_check_response(c, &c->reply_type) < 0)
{
return NULL;
}
@@ -2363,7 +2363,7 @@ PHP_REDIS_API zval *cluster_zval_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
array_init(z_ret);
// Call our callback
- if (cb(c->cmd_sock, z_ret, c->reply_len, NULL TSRMLS_CC) == FAILURE) {
+ if (cb(c->cmd_sock, z_ret, c->reply_len, NULL) == FAILURE) {
zval_dtor(z_ret);
return NULL;
}
@@ -2388,7 +2388,7 @@ PHP_REDIS_API void cluster_multi_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
c->cmd_slot = fi->slot;
c->cmd_sock = SLOT_SOCK(c, fi->slot);
- if (cluster_check_response(c, &c->reply_type TSRMLS_CC) < 0) {
+ if (cluster_check_response(c, &c->reply_type) < 0) {
zval_dtor(multi_resp);
RETURN_FALSE;
}
@@ -2417,7 +2417,7 @@ PHP_REDIS_API void cluster_mbulk_mget_resp(INTERNAL_FUNCTION_PARAMETERS,
c->cmd_sock->serializer = c->flags->serializer;
c->cmd_sock->compression = c->flags->compression;
short fail = c->reply_type != TYPE_MULTIBULK || c->reply_len == -1 ||
- mbulk_resp_loop(c->cmd_sock, mctx->z_multi, c->reply_len, NULL TSRMLS_CC) == FAILURE;
+ mbulk_resp_loop(c->cmd_sock, mctx->z_multi, c->reply_len, NULL) == FAILURE;
// If we had a failure, pad results with FALSE to indicate failure. Non
// existant keys (e.g. for MGET will come back as NULL)
@@ -2449,7 +2449,7 @@ PHP_REDIS_API void cluster_msetnx_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluste
// Protect against an invalid response type
if (c->reply_type != TYPE_INT) {
- php_error_docref(0 TSRMLS_CC, E_WARNING,
+ php_error_docref(0, E_WARNING,
"Invalid response type for MSETNX");
while (real_argc--) {
add_next_index_bool(mctx->z_multi, 0);
@@ -2483,7 +2483,7 @@ PHP_REDIS_API void cluster_del_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *
// If we get an invalid reply, inform the client
if (c->reply_type != TYPE_INT) {
- php_error_docref(0 TSRMLS_CC, E_WARNING,
+ php_error_docref(0, E_WARNING,
"Invalid reply type returned for DEL command");
efree(mctx);
return;
@@ -2513,7 +2513,7 @@ PHP_REDIS_API void cluster_mset_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster
// If we get an invalid reply type something very wrong has happened,
// and we have to abort.
if (c->reply_type != TYPE_LINE) {
- php_error_docref(0 TSRMLS_CC, E_ERROR,
+ php_error_docref(0, E_ERROR,
"Invalid reply type returned for MSET command");
zval_dtor(mctx->z_multi);
efree(mctx->z_multi);
@@ -2584,7 +2584,7 @@ cluster_mbulk_assoc_resp(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
/* MULTI BULK response where we don't touch the values (e.g. KEYS) */
int mbulk_resp_loop_raw(RedisSock *redis_sock, zval *z_result,
- long long count, void *ctx TSRMLS_DC)
+ long long count, void *ctx)
{
char *line;
int line_len;
@@ -2592,7 +2592,7 @@ int mbulk_resp_loop_raw(RedisSock *redis_sock, zval *z_result,
// Iterate over the number we have
while (count--) {
// Read the line, which should never come back null
- line = redis_sock_read(redis_sock, &line_len TSRMLS_CC);
+ line = redis_sock_read(redis_sock, &line_len);
if (line == NULL) return FAILURE;
// Add to our result array
@@ -2606,7 +2606,7 @@ int mbulk_resp_loop_raw(RedisSock *redis_sock, zval *z_result,
/* MULTI BULK response where we unserialize everything */
int mbulk_resp_loop(RedisSock *redis_sock, zval *z_result,
- long long count, void *ctx TSRMLS_DC)
+ long long count, void *ctx)
{
char *line;
int line_len;
@@ -2614,11 +2614,11 @@ int mbulk_resp_loop(RedisSock *redis_sock, zval *z_result,
/* Iterate over the lines we have to process */
while (count--) {
/* Read our line */
- line = redis_sock_read(redis_sock, &line_len TSRMLS_CC);
+ line = redis_sock_read(redis_sock, &line_len);
if (line != NULL) {
zval z_unpacked;
- if (redis_unpack(redis_sock, line, line_len, &z_unpacked TSRMLS_CC)) {
+ if (redis_unpack(redis_sock, line, line_len, &z_unpacked)) {
add_next_index_zval(z_result, &z_unpacked);
} else {
add_next_index_stringl(z_result, line, line_len);
@@ -2635,7 +2635,7 @@ int mbulk_resp_loop(RedisSock *redis_sock, zval *z_result,
/* MULTI BULK response where we turn key1,value1 into key1=>value1 */
int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result,
- long long count, void *ctx TSRMLS_DC)
+ long long count, void *ctx)
{
char *line, *key = NULL;
int line_len, key_len = 0;
@@ -2649,7 +2649,7 @@ int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result,
// Iterate through our elements
while (count--) {
// Grab our line, bomb out on failure
- line = redis_sock_read(redis_sock, &line_len TSRMLS_CC);
+ line = redis_sock_read(redis_sock, &line_len);
if (!line) return -1;
if (idx++ % 2 == 0) {
@@ -2659,7 +2659,7 @@ int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result,
} else {
/* Attempt unpacking */
zval z_unpacked;
- if (redis_unpack(redis_sock, line, line_len, &z_unpacked TSRMLS_CC)) {
+ if (redis_unpack(redis_sock, line, line_len, &z_unpacked)) {
add_assoc_zval(z_result, key, &z_unpacked);
} else {
add_assoc_stringl_ex(z_result, key, key_len, line, line_len);
@@ -2675,7 +2675,7 @@ int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result,
/* MULTI BULK loop processor where we expect key,score key, score */
int mbulk_resp_loop_zipdbl(RedisSock *redis_sock, zval *z_result,
- long long count, void *ctx TSRMLS_DC)
+ long long count, void *ctx)
{
char *line, *key = NULL;
int line_len, key_len = 0;
@@ -2688,14 +2688,14 @@ int mbulk_resp_loop_zipdbl(RedisSock *redis_sock, zval *z_result,
// While we have elements
while (count--) {
- line = redis_sock_read(redis_sock, &line_len TSRMLS_CC);
+ line = redis_sock_read(redis_sock, &line_len);
if (line != NULL) {
if (idx++ % 2 == 0) {
key = line;
key_len = line_len;
} else {
zval zv, *z = &zv;
- if (redis_unpack(redis_sock,key,key_len, z TSRMLS_CC)) {
+ if (redis_unpack(redis_sock,key,key_len, z)) {
zend_string *zstr = zval_get_string(z);
add_assoc_double_ex(z_result, ZSTR_VAL(zstr), ZSTR_LEN(zstr), atof(line));
zend_string_release(zstr);
@@ -2716,7 +2716,7 @@ int mbulk_resp_loop_zipdbl(RedisSock *redis_sock, zval *z_result,
/* MULTI BULK where we're passed the keys, and we attach vals */
int mbulk_resp_loop_assoc(RedisSock *redis_sock, zval *z_result,
- long long count, void *ctx TSRMLS_DC)
+ long long count, void *ctx)
{
char *line;
int line_len,i = 0;
@@ -2725,11 +2725,11 @@ int mbulk_resp_loop_assoc(RedisSock *redis_sock, zval *z_result,
// Loop while we've got replies
while (count--) {
zend_string *zstr = zval_get_string(&z_keys[i]);
- line = redis_sock_read(redis_sock, &line_len TSRMLS_CC);
+ line = redis_sock_read(redis_sock, &line_len);
if (line != NULL) {
zval z_unpacked;
- if (redis_unpack(redis_sock, line, line_len, &z_unpacked TSRMLS_CC)) {
+ if (redis_unpack(redis_sock, line, line_len, &z_unpacked)) {
add_assoc_zval_ex(z_result, ZSTR_VAL(zstr), ZSTR_LEN(zstr), &z_unpacked);
} else {
add_assoc_stringl_ex(z_result, ZSTR_VAL(zstr), ZSTR_LEN(zstr), line, line_len);