Skip to content

Commit

Permalink
Fix regression in redisxInit()
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 11, 2024
1 parent 561d65b commit becd47c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/redisx-net.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,17 @@ static void rUnregisterServer(const Redis *redis) {
* @param cl
* @param idx
*/
static void rInitClient(RedisClient *cl, enum redisx_channel idx) {
static void rInitClient(Redis *redis, enum redisx_channel idx) {
RedisPrivate *p = (RedisPrivate *) redis->priv;
RedisClient *cl = &p->clients[idx];
ClientPrivate *cp;

cp = calloc(1, sizeof(ClientPrivate));
x_check_alloc(cp);

cp->redis = redis;
cp->idx = idx;

pthread_mutex_init(&cp->readLock, NULL);
pthread_mutex_init(&cp->writeLock, NULL);
pthread_mutex_init(&cp->pendingLock, NULL);
Expand Down Expand Up @@ -860,11 +864,7 @@ Redis *redisxInit(const char *server) {
x_check_alloc(p->clients);

// Initialize clients.
for(i = REDISX_CHANNELS; --i >= 0; ) {
ClientPrivate *cp = (ClientPrivate *) p->clients[i].priv;
rInitClient(&p->clients[i], i);
cp->redis = redis;
}
for(i = REDISX_CHANNELS; --i >= 0; ) rInitClient(redis, i);

// Alias clients
redis->interactive = &p->clients[REDISX_INTERACTIVE_CHANNEL];
Expand Down
2 changes: 1 addition & 1 deletion test/src/test-hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main() {
Redis *redis = redisxInit("localhost");
RedisEntry *e;
RESP *resp;
const char *json;
char *json;
int n = -1;

xSetDebug(TRUE);
Expand Down

0 comments on commit becd47c

Please sign in to comment.