From bd3c897e9fa86ec0e1ddd80986fc704858129897 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 10 Jul 2013 14:37:13 +0200 Subject: [PATCH] anet.c: save some vertical space. --- src/anet.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/anet.c b/src/anet.c index 3726b9f6..257b491e 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; }