- /* Check for maximum connections limit */
- if (conn->param) {
- if (conn->param->connections_max &&
- server->stat.my_clients >= conn->param->connections_max) {
- SILC_LOG_INFO(("Server is full, closing %s (%s) connection",
- sock->hostname, sock->ip));
- silc_server_disconnect_remote(server, sock,
- "Server closed connection: "
- "Server is full, try again later");
- server->stat.auth_failures++;
- goto out;
- }
-
- max_per_host = conn->param->connections_max_per_host;
- }
-
- if (num_sockets >= max_per_host) {
- SILC_LOG_INFO(("Too many connections from %s (%s), closing connection",
- sock->hostname, sock->ip));
- silc_server_disconnect_remote(server, sock,
- "Server closed connection: "
- "Too many connections from your host");
+ /* Verify whether this connection is after all allowed to connect */
+ if (!silc_server_connection_allowed(server, sock, ctx->conn_type,
+ &server->config->param,
+ conn->param, ctx->ske)) {