[Icecast-dev] [PATCH 10/31] Connection: _accept_connection, simplify logic

Niv Sardi
Fri, 30 Jul 2010 14:54:32 -0000

Execute test only when needed.

Signed-off-by: Niv Sardi <nsardi at smartjog.com>
---
 src/connection.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 82112b2..dcc5b39 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -533,10 +533,11 @@ static connection_t *_accept_connection(int duration)
         if (strncmp (ip, "::ffff:", 7) == 0)
             memmove (ip, ip+7, strlen (ip+7)+1);

-        if (accept_ip_address (ip))
+        if (accept_ip_address (ip)) {
             con = connection_create (sock, serversock, ip);
-        if (con)
-            return con;
+            if (con)
+                return con;
+        }
         sock_close (sock);
     }
     else
--
1.7.1