Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34d6403

Browse files
committed
Issue #1523
1 parent 5cb30fb commit 34d6403

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

library.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,9 +2344,9 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
23442344
char *errmsg = NULL;
23452345

23462346
if (redis_sock->port < 0) {
2347-
spprintf(&errmsg, 0, "read error on connection to %S", redis_sock->host);
2347+
spprintf(&errmsg, 0, "read error on connection to %s", ZSTR_VAL(redis_sock->host));
23482348
} else {
2349-
spprintf(&errmsg, 0, "read error on connection to %S:%d", redis_sock->host, redis_sock->port);
2349+
spprintf(&errmsg, 0, "read error on connection to %s:%d", ZSTR_VAL(redis_sock->host), redis_sock->port);
23502350
}
23512351
// Close our socket
23522352
redis_sock_disconnect(redis_sock, 1 TSRMLS_CC);

redis.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,16 @@ redis_sock_get(zval *id TSRMLS_DC, int no_throw)
612612
}
613613

614614
if (redis_sock_server_open(redis_sock TSRMLS_CC) < 0) {
615+
if (!no_throw) {
616+
char *errmsg = NULL;
617+
if (redis_sock->port < 0) {
618+
spprintf(&errmsg, 0, "Redis server %s went away", ZSTR_VAL(redis_sock->host));
619+
} else {
620+
spprintf(&errmsg, 0, "Redis server %s:%d went away", ZSTR_VAL(redis_sock->host), redis_sock->port);
621+
}
622+
REDIS_THROW_EXCEPTION(errmsg, 0);
623+
efree(errmsg);
624+
}
615625
return NULL;
616626
}
617627

0 commit comments

Comments
 (0)