summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-15 12:11:28 +0000
committersmatz <smatz@openttd.org>2011-02-15 12:11:28 +0000
commitd2d6b263b3f2a9b4b91e418d29113216a9144b5f (patch)
treeab054c0eb09dd49904fc552840b870ef4b647222 /src
parent949bfabe5e09563a835c052705a0be101112351c (diff)
downloadopenttd-d2d6b263b3f2a9b4b91e418d29113216a9144b5f.tar.xz
(svn r22085) -Fix: assert when connecting to the admin port
Diffstat (limited to 'src')
-rw-r--r--src/network/network_admin.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp
index 22c833288..b6d5c3e6c 100644
--- a/src/network/network_admin.cpp
+++ b/src/network/network_admin.cpp
@@ -81,7 +81,12 @@ ServerNetworkAdminSocketHandler::~ServerNetworkAdminSocketHandler()
*/
/* static */ bool ServerNetworkAdminSocketHandler::AllowConnection()
{
- return !StrEmpty(_settings_client.network.admin_password) && _network_admins_connected < MAX_ADMINS;
+ bool accept = !StrEmpty(_settings_client.network.admin_password) && _network_admins_connected < MAX_ADMINS;
+ /* We can't go over the MAX_ADMINS limit here. However, if we accept
+ * the connection, there has to be space in the pool. */
+ assert_compile(NetworkAdminSocketPool::MAX_SIZE == MAX_ADMINS);
+ assert(!accept || ServerNetworkAdminSocketHandler::CanAllocateItem());
+ return accept;
}
/** Send the packets for the server sockets. */