summaryrefslogtreecommitdiff
path: root/src/net/ipc.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-19 18:51:49 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-19 18:51:49 +0300
commit5a5d0398820a482a88f878638e74ccad6f2d2c50 (patch)
treeb4f4f694d62c2b4ae615dc0eb30aef25a2a77854 /src/net/ipc.cpp
parent2d5ded6b4f51b6d056ed6f2ae68aa208373c48ac (diff)
downloadmanaverse-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.cpp10
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 ++;
}
}
}