summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-07-10 14:37:13 +0200
committerantirez <antirez@gmail.com>2013-07-11 17:09:25 +0200
commit8669e70921cf1734db435df51011595973271f1f (patch)
treef7480b6a9558fa9b9e99851e9465f06b2f22cc3a
parent9e089e7c5dbfd4ce94f59d3213fefa31a8a6228c (diff)
downloadredis-8669e70921cf1734db435df51011595973271f1f.tar.gz
anet.c: save some vertical space.
-rw-r--r--src/anet.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/anet.c b/src/anet.c
index 3726b9f67..257b491e9 100644
--- a/src/anet.c
+++ b/src/anet.c
@@ -237,18 +237,11 @@ static int anetTcpGenericConnect(char *err, char *addr, int port, int flags)
continue;
/* if we set err then goto cleanup, otherwise next */
- if (anetSetReuseAddr(err,s) == ANET_ERR) {
+ if (anetSetReuseAddr(err,s) == ANET_ERR) goto error;
+ if (flags & ANET_CONNECT_NONBLOCK && anetNonBlock(err,s) != ANET_OK)
goto error;
- }
- if (flags & ANET_CONNECT_NONBLOCK) {
- if (anetNonBlock(err,s) != ANET_OK)
- goto error;
- }
if (connect(s,p->ai_addr,p->ai_addrlen) == -1) {
- if (errno == EINPROGRESS &&
- flags & ANET_CONNECT_NONBLOCK)
- goto end;
-
+ if (errno == EINPROGRESS && flags & ANET_CONNECT_NONBLOCK) goto end;
close(s);
continue;
}