diff options
author | smatz <smatz@openttd.org> | 2011-02-15 12:11:28 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-02-15 12:11:28 +0000 |
commit | d2d6b263b3f2a9b4b91e418d29113216a9144b5f (patch) | |
tree | ab054c0eb09dd49904fc552840b870ef4b647222 | |
parent | 949bfabe5e09563a835c052705a0be101112351c (diff) | |
download | openttd-d2d6b263b3f2a9b4b91e418d29113216a9144b5f.tar.xz |
(svn r22085) -Fix: assert when connecting to the admin port
-rw-r--r-- | src/network/network_admin.cpp | 7 |
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. */ |