Skip to content

Commit

Permalink
Issue #1523
Browse files Browse the repository at this point in the history
  • Loading branch information
yatsukhnenko committed May 14, 2019
1 parent 5cb30fb commit 34d6403
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library.c
Expand Up @@ -2344,9 +2344,9 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
char *errmsg = NULL;

if (redis_sock->port < 0) {
spprintf(&errmsg, 0, "read error on connection to %S", redis_sock->host);
spprintf(&errmsg, 0, "read error on connection to %s", ZSTR_VAL(redis_sock->host));
} else {
spprintf(&errmsg, 0, "read error on connection to %S:%d", redis_sock->host, redis_sock->port);
spprintf(&errmsg, 0, "read error on connection to %s:%d", ZSTR_VAL(redis_sock->host), redis_sock->port);
}
// Close our socket
redis_sock_disconnect(redis_sock, 1 TSRMLS_CC);
Expand Down
10 changes: 10 additions & 0 deletions redis.c
Expand Up @@ -612,6 +612,16 @@ redis_sock_get(zval *id TSRMLS_DC, int no_throw)
}

if (redis_sock_server_open(redis_sock TSRMLS_CC) < 0) {
if (!no_throw) {
char *errmsg = NULL;
if (redis_sock->port < 0) {
spprintf(&errmsg, 0, "Redis server %s went away", ZSTR_VAL(redis_sock->host));
} else {
spprintf(&errmsg, 0, "Redis server %s:%d went away", ZSTR_VAL(redis_sock->host), redis_sock->port);
}
REDIS_THROW_EXCEPTION(errmsg, 0);
efree(errmsg);
}
return NULL;
}

Expand Down

0 comments on commit 34d6403

Please sign in to comment.