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:
authorPavlo Yatsukhnenko <yatsukhnenko@users.noreply.github.com>2019-05-12 23:15:10 +0300
committerGitHub <noreply@github.com>2019-05-12 23:15:10 +0300
commit34c8c68873dd2fd5c7e3f5bcf7367d31da78ae34 (patch)
treec2cad51fd1c7753fcf5597eb192f610dbb972eeb /library.c
parent95efd2140ad7d8e6cbee73efcf98338651673ee6 (diff)
parente8fb49be5f33ad61ac4c8a358b327b88014f3494 (diff)
Merge pull request #1531 from phpredis/issue.1523
Issue #1523 Let's merge it and see users reaction 🤣
Diffstat (limited to 'library.c')
-rw-r--r--library.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/library.c b/library.c
index df675dc9..0f3d9f58 100644
--- a/library.c
+++ b/library.c
@@ -2340,11 +2340,19 @@ redis_sock_gets(RedisSock *redis_sock, char *buf, int buf_size,
if(php_stream_get_line(redis_sock->stream, buf, buf_size, line_size)
== NULL)
{
+ char *errmsg = NULL;
+
+ if (redis_sock->port < 0) {
+ spprintf(&errmsg, 0, "read error on connection to %S", redis_sock->host);
+ } else {
+ spprintf(&errmsg, 0, "read error on connection to %S:%d", redis_sock->host, redis_sock->port);
+ }
// Close our socket
redis_sock_disconnect(redis_sock, 1 TSRMLS_CC);
// Throw a read error exception
- REDIS_THROW_EXCEPTION( "read error on connection", 0);
+ REDIS_THROW_EXCEPTION(errmsg, 0);
+ efree(errmsg);
return -1;
}