diff --git a/include/maxscale/service.h b/include/maxscale/service.h index ac1574647..0da2dcfa3 100644 --- a/include/maxscale/service.h +++ b/include/maxscale/service.h @@ -35,7 +35,6 @@ #include #include #include -#include #include MXS_BEGIN_DECLS @@ -128,7 +127,6 @@ typedef struct service int state; /**< The service state */ int client_count; /**< Number of connected clients */ int max_connections; /**< Maximum client connections */ - QUEUE_CONFIG *queued_connections; /**< Queued connections, if set */ SERV_LISTENER *ports; /**< Linked list of ports and protocols * that this service will listen on */ char *routerModule; /**< Name of router module to use */ diff --git a/server/core/config_runtime.cc b/server/core/config_runtime.cc index 5c4b2ca48..54d57a486 100644 --- a/server/core/config_runtime.cc +++ b/server/core/config_runtime.cc @@ -596,7 +596,9 @@ bool runtime_alter_service(SERVICE *service, const char* zKey, const char* zValu { valid = true; // TODO: Once connection queues are implemented, use correct values - serviceSetConnectionLimits(service, i, 0, 0); + const int queued_connections = 0; // At most this many pending connections. + const int timeout = 0; // Wait at most this much for a connection. + serviceSetConnectionLimits(service, i, queued_connections, timeout); } } else if (key == CN_CONNECTION_TIMEOUT) diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 41aa75638..df7459f55 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -56,7 +56,6 @@ #include #include "maxscale/modules.h" -#include "maxscale/queuemanager.h" #include "maxscale/semaphore.hh" #include "maxscale/session.h" #include "maxscale/worker.hh" @@ -2435,14 +2434,13 @@ dcb_accept(DCB *listener) if (client_dcb->service->max_connections && client_dcb->service->client_count >= client_dcb->service->max_connections) { - if (!mxs_enqueue(client_dcb->service->queued_connections, client_dcb)) + // TODO: If connections can be queued, this is the place to put the + // TODO: connection on that queue. + if (client_dcb->func.connlimit) { - if (client_dcb->func.connlimit) - { - client_dcb->func.connlimit(client_dcb, client_dcb->service->max_connections); - } - dcb_close(client_dcb); + client_dcb->func.connlimit(client_dcb, client_dcb->service->max_connections); } + dcb_close(client_dcb); client_dcb = NULL; } } diff --git a/server/core/service.cc b/server/core/service.cc index 7906a8bc4..a043f1324 100644 --- a/server/core/service.cc +++ b/server/core/service.cc @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -54,7 +53,6 @@ #include "maxscale/config.h" #include "maxscale/filter.h" #include "maxscale/modules.h" -#include "maxscale/queuemanager.h" #include "maxscale/service.h" /** This define is needed in CentOS 6 systems */ @@ -97,7 +95,6 @@ static int find_type(typelib_t* tl, const char* needle, int maxlen); static void service_add_qualified_param(SERVICE* svc, MXS_CONFIG_PARAMETER* param); static void service_internal_restart(void *data); -static void service_queue_check(void *data); static void service_calculate_weights(SERVICE *service); SERVICE* service_alloc(const char *name, const char *router) @@ -145,7 +142,6 @@ SERVICE* service_alloc(const char *name, const char *router) service->name = my_name; service->routerModule = my_router; service->users_from_all = false; - service->queued_connections = NULL; service->localhost_match_wildcard_host = SERVICE_PARAM_UNINIT; service->retry_start = true; service->conn_idle_timeout = SERVICE_NO_SESSION_TIMEOUT; @@ -1157,6 +1153,8 @@ void serviceSetVersionString(SERVICE *service, const char* value) * @param max The maximum number of client connections at any one time * @param queued The maximum number of connections to queue up when * max_connections clients are already connected + * @param timeout Maximum amount of time to wait for a connection to + * become available. * @return 1 on success, 0 when the values are invalid */ int @@ -1169,45 +1167,13 @@ serviceSetConnectionLimits(SERVICE *service, int max, int queued, int timeout) } service->max_connections = max; - if (queued && timeout) - { - char callback_name[100]; - sprintf(callback_name, "Check queued connections %p", service); - /* If memory allocation fails, result will be null so no queue */ - service->queued_connections = mxs_queue_alloc(queued, timeout); - if (service->queued_connections) - { - hktask_add(callback_name, service_queue_check, (void *)service->queued_connections, 1); - } - } + + ss_info_dassert(queued == 0, "Queued connections not implemented."); + ss_info_dassert(timeout == 0, "Queued connections not implemented."); return 1; } -/* - * @brief The callback function triggered by housekeeping every second - * - * This function removes any expired connection requests from the queue, and - * sends an error message "too many connections" for them. - * - * @param The parameter provided by the callback is the queue config - */ -static void -service_queue_check(void *data) -{ - QUEUE_ENTRY expired; - QUEUE_CONFIG *queue_config = (QUEUE_CONFIG *)data; - /* The queued connections are in a FIFO queue, so we only look at the */ - /* start of the queue, and remove any expired entries. As soon as this */ - /* returns nothing, we stop. */ - while ((mxs_dequeue_if_expired(queue_config, &expired))) - { - DCB *dcb = (DCB *)expired.queued_object; - dcb->func.connlimit(dcb, queue_config->queue_limit); - dcb_close(dcb); - } -} - /** * Enable or disable the restarting of the service on failure. * @param service Service to configure