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@gmail.com>2019-03-23 15:10:58 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2019-03-23 15:10:58 +0300
commite8fb49be5f33ad61ac4c8a358b327b88014f3494 (patch)
treec8c4996b1360f03165d3c03cb8fdc886c43ae305 /library.c
parent603ba48d58409b4bb4f8012b3eceb4596e064945 (diff)
Issue #1523
Add server address to exception message.
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 e91e1569..671055b3 100644
--- a/library.c
+++ b/library.c
@@ -2295,11 +2295,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;
}