diff options
-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. */ |