worker-pool.c revision cca4ba2a504d70a9fe9fee37f8433997359de52c
#include "lib.h"
#include "ioloop.h"
#include "llist.h"
#include "master-service.h"
#include "worker-connection.h"
#include "worker-pool.h"
struct worker_connection_list {
struct worker_connection *conn;
};
struct worker_pool {
char *socket_path;
unsigned int connection_count;
};
static void
struct worker_connection_list *list);
struct worker_pool *
{
struct worker_pool *pool;
return pool;
}
{
}
}
}
{
}
{
struct worker_connection *conn;
struct worker_connection_list *list;
if (worker_connection_connect(conn) < 0) {
return -1;
}
pool->connection_count++;
return 0;
}
static void
struct worker_connection_list *list)
{
pool->connection_count--;
}
{
struct worker_connection_list *list;
unsigned int limit;
return 1;
return limit;
}
/* we have at least one connection that has already been created,
but without having handshaked yet. wait until it's finished. */
return 0;
}
struct worker_connection **conn_r)
{
struct worker_connection_list *list;
unsigned int max_connections;
}
return FALSE;
if (worker_pool_add_connection(pool) < 0)
return FALSE;
}
/* treat worker connection as another client. this is required (once,
at least) so that master doesn't think we are busy doing nothing and
ignoring an idle-kill. */
return TRUE;
}
{
}
}
}
struct worker_connection *conn)
{
struct worker_connection_list *list;
if (worker_connection_is_busy(conn)) {
/* not finished with all queued requests yet */
return;
}
break;
}
else {
}
}
struct worker_connection *
const char *username)
{
struct worker_connection_list *list;
const char *worker_user;
}
return NULL;
}