diff -r 1c67f512779b -r 10c7dce1a043 memcache/server.c --- a/memcache/server.c Fri Aug 29 23:31:17 2008 +0300 +++ b/memcache/server.c Sat Aug 30 19:13:15 2008 +0300 @@ -3,18 +3,24 @@ #include #include "server.h" +#include "memcache.h" #include "connection.h" #include "request.h" #include "../memcache.h" #include "../common.h" -struct memcache_server *memcache_server_alloc (struct config_endpoint *endpoint, int max_connections) { +struct memcache_server *memcache_server_alloc (struct memcache *mc, struct config_endpoint *endpoint, int max_connections) { struct memcache_server *server = NULL; + // warn if nonsensical arguments + if (max_connections > 1 && mc->pipeline_requests) + WARNING("only one connection will ever be used with pipeline_requests"); + if ((server = calloc(1, sizeof(*server))) == NULL) ERROR("calloc"); // store the vars + server->mc = mc; server->endpoint = endpoint; server->max_connections = max_connections; @@ -113,7 +119,8 @@ // look for idle connections to service the request LIST_FOREACH(conn, &server->conn_list, connlist_node) { - if (memcache_conn_is_available(conn)) { + // handle pipelining as well + while (memcache_conn_is_available(conn)) { // remove the req from the queue and execute it TAILQ_REMOVE(&server->req_queue, req, reqqueue_node);