diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-19 18:51:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-19 18:51:49 +0300 |
commit | 5a5d0398820a482a88f878638e74ccad6f2d2c50 (patch) | |
tree | b4f4f694d62c2b4ae615dc0eb30aef25a2a77854 /src/net/ipc.cpp | |
parent | 2d5ded6b4f51b6d056ed6f2ae68aa208373c48ac (diff) | |
download | manaverse-5a5d0398820a482a88f878638e74ccad6f2d2c50.tar.gz manaverse-5a5d0398820a482a88f878638e74ccad6f2d2c50.tar.bz2 manaverse-5a5d0398820a482a88f878638e74ccad6f2d2c50.tar.xz manaverse-5a5d0398820a482a88f878638e74ccad6f2d2c50.zip |
Fix possible infinite loop in ipc code.
Diffstat (limited to 'src/net/ipc.cpp')
-rw-r--r-- | src/net/ipc.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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 ++; } } } |