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

Niv Sardi nsardi at smartjog.com
Fri Jul 30 07:54:32 PDT 2010


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



More information about the Icecast-dev mailing list