diff options
-rw-r--r-- | src/cluster.c | 4 | ||||
-rw-r--r-- | src/redis-cli.c | 5 | ||||
-rw-r--r-- | src/replication.c | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/cluster.c b/src/cluster.c index 10ed25db8..608f8d2c5 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -4307,8 +4307,8 @@ int migrateGetSocket(redisClient *c, robj *host, robj *port, long timeout) { } /* Create the socket */ - fd = anetTcpNonBlockConnect(server.neterr,c->argv[1]->ptr, - atoi(c->argv[2]->ptr)); + fd = anetTcpNonBlockBindConnect(server.neterr,c->argv[1]->ptr, + atoi(c->argv[2]->ptr),REDIS_BIND_ADDR); if (fd == -1) { sdsfree(name); addReplyErrorFormat(c,"Can't connect to target node: %s", diff --git a/src/redis-cli.c b/src/redis-cli.c index 07bcf0a04..34070ab80 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -524,7 +524,8 @@ static int cliReadReply(int output_raw_strings) { } if (config.interactive) { /* Filter cases where we should reconnect */ - if (context->err == REDIS_ERR_IO && errno == ECONNRESET) + if (context->err == REDIS_ERR_IO && + (errno == ECONNRESET || errno == EPIPE)) return REDIS_ERR; if (context->err == REDIS_ERR_EOF) return REDIS_ERR; @@ -1914,6 +1915,8 @@ int main(int argc, char **argv) { argc -= firstarg; argv += firstarg; + signal(SIGPIPE, SIG_IGN); + /* Latency mode */ if (config.latency_mode) { if (cliConnect(0) == REDIS_ERR) exit(1); diff --git a/src/replication.c b/src/replication.c index 77f9fa8bc..1a4ca2503 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1357,7 +1357,8 @@ error: int connectWithMaster(void) { int fd; - fd = anetTcpNonBlockConnect(NULL,server.masterhost,server.masterport); + fd = anetTcpNonBlockBindConnect(NULL, + server.masterhost,server.masterport,REDIS_BIND_ADDR); if (fd == -1) { redisLog(REDIS_WARNING,"Unable to connect to MASTER: %s", strerror(errno)); |