From 5a5d0398820a482a88f878638e74ccad6f2d2c50 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 19 Jul 2014 18:51:49 +0300 Subject: Fix possible infinite loop in ipc code. --- src/net/ipc.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/net') diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 03113902d..559c65a59 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -145,15 +145,15 @@ void IPC::start() if (ipc) return; - unsigned short ipc_port(44007); + unsigned short port(44007); if (getenv("IPC_PORT")) - ipc_port = atoi(getenv("IPC_PORT")); + port = atoi(getenv("IPC_PORT")); logger->log("Starting IPC..."); - while (true) + for (int port = 44007; port < 65535; port ++) { logger->log(" -> trying port %d...", ipc_port); - ipc = new IPC(ipc_port); + ipc = new IPC(port); if (ipc->init()) { logger->log(" -> Port %d selected", ipc_port); @@ -161,7 +161,7 @@ void IPC::start() } else { - ipc_port ++; + port ++; } } } -- cgit v1.2.3-70-g09d2